From 8a4d9ff32a16ff5b1ca1056e903e7e65feb32649 Mon Sep 17 00:00:00 2001 From: Julia Kreger Date: Wed, 16 Mar 2016 18:23:03 -0400 Subject: [PATCH] DHCP test improvements The DHCP test ultimately relies upon bifrost putting in place the correct DHCP configuration to reliably boot machines, and then (hopefully) ensure that no unknown machines are given leases. This is in order to help simulate the Infracloud configuration. In order to do this, and hopefully get the CI test into a passing state, I have increased the amount of memory allocated to each VM as the realistic minimum for IPA is 1 GB, and introduced specific stops and starts to VMs present during the test sequence in order to limit the number of concurrent running virtual machines. Change-Id: Ia612414edd80d154200e9df12b410a327db19cff --- playbooks/test-bifrost-dhcp.yaml | 52 ++++++++++++++++++++------ scripts/test-bifrost-inventory-dhcp.sh | 5 ++- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/playbooks/test-bifrost-dhcp.yaml b/playbooks/test-bifrost-dhcp.yaml index cf8280451..0af1698bc 100644 --- a/playbooks/test-bifrost-dhcp.yaml +++ b/playbooks/test-bifrost-dhcp.yaml @@ -8,11 +8,23 @@ --- - hosts: localhost connection: local - name: "Remove existing leases file" + name: "Setting pre-test conditions" become: yes ignore_errors: yes tasks: - - command: rm /var/lib/misc/dnsmasq.leases + # NOTE(TheJulia): While the test was created to run with five VMs, + # in the interest of keeping the active memory footprint small, + # should stop all of the VMs in advance, so we can proceed with + # install and initial deploy. + - name: Attempt to stop all test VMs + virt: + name: "testvm{{ item }}" + command: "stop" + state: shutdown + with_sequence: start=1 end={{ test_vm_num_nodes | default('5') }} + ignore_errors: yes + - name: Remove pre-existing leases file + command: rm /var/lib/misc/dnsmasq.leases - hosts: localhost connection: local name: "Executes install, enrollment, and testing in one playbook" @@ -94,6 +106,32 @@ max_fail_percentage: 0 roles: - role: bifrost-test-vm +- hosts: baremetal + connection: local + name: "Unprovisions the test node" + become: no + gather_facts: no + roles: + - role: bifrost-unprovision-node-dynamic + - role: ironic-delete-dynamic +- hosts: localhost + connection: local + name: "Executes test script" + become: yes + tasks: + # NOTE(TheJulia): Moved the power ON of the excess VMs until after + # the other test VMs have been shutdown, in order to explicitly + # validate that the dhcp config is working as expected and not + # serving these requests. + - name: Power on remaining test VMs + virt: + name: "testvm{{ item }}" + command: "start" + with_sequence: start=4 end={{ test_vm_num_nodes | default('5') }} + ignore_errors: yes + - name: Wait 30 seconds + pause: + seconds: 30 - hosts: localhost connection: local name: "Executes test script" @@ -104,16 +142,6 @@ inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool }}" roles: - role: bifrost-test-dhcp - cleaning: false - testing: true environment: http_proxy: "{{ lookup('env','http_proxy') }}" https_proxy: "{{ lookup('env','https_proxy') }}" -- hosts: baremetal - connection: local - name: "Unprovisions the test node" - become: no - gather_facts: no - roles: - - role: bifrost-unprovision-node-dynamic - - role: ironic-delete-dynamic diff --git a/scripts/test-bifrost-inventory-dhcp.sh b/scripts/test-bifrost-inventory-dhcp.sh index 1644a0519..2872b9fb9 100755 --- a/scripts/test-bifrost-inventory-dhcp.sh +++ b/scripts/test-bifrost-inventory-dhcp.sh @@ -29,7 +29,7 @@ ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml --synt ansible-playbook -vvvv -i inventory/localhost test-bifrost-dynamic.yaml --syntax-check --list-tasks # Create the test VMS -ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml -e test_vm_num_nodes="5" -e test_vm_memory_size="512" +ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml -e test_vm_num_nodes="5" -e test_vm_memory_size="1024" # cut file head -n -2 /tmp/baremetal.csv > /tmp/baremetal.csv.new && mv /tmp/baremetal.csv.new /tmp/baremetal.csv @@ -52,7 +52,8 @@ ansible-playbook -vvvv \ -e use_cirros=true \ -e testing_user=cirros \ -e inventory_dhcp=true \ - -e inventory_dhcp_static_ip=true + -e inventory_dhcp_static_ip=true \ + -e test_vm_num_nodes="5" EXITCODE=$? if [ $EXITCODE != 0 ]; then