From 8980f25c639f908201170a8c6dc7ea7d9465cc91 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Mon, 17 Oct 2016 14:38:29 +0100 Subject: [PATCH] Move to use Tempest tests for Neutron We're seeing a lot of gate failures due to race conditions that are causing various failures (dhcp agent not starting in time, iptables rules not being added in time etc.) To avoid recreating tempest, lets use tempest to test using the networking api tests. Change-Id: I624d1c7ebbc191b1ddb89eef22dd120df6bb5415 --- tests/ansible-role-requirements.yml | 4 + tests/calico_inventory | 29 +------ tests/lxb_inventory | 29 +------ tests/ovs_inventory | 29 +------ tests/test-neutron-functional.yml | 115 ++-------------------------- tests/test.yml | 3 + 6 files changed, 17 insertions(+), 192 deletions(-) diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index 28c2dce0..fd57da6d 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -38,6 +38,10 @@ src: https://git.openstack.org/openstack/openstack-ansible-os_keystone scm: git version: master +- name: os_tempest + src: https://git.openstack.org/openstack/openstack-ansible-os_tempest + scm: git + version: master - name: rabbitmq_server src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server scm: git diff --git a/tests/calico_inventory b/tests/calico_inventory index b6f199b7..997996b1 100644 --- a/tests/calico_inventory +++ b/tests/calico_inventory @@ -61,32 +61,5 @@ neutron_metadata_agent neutron_server neutron_calico_dhcp_agent -[nova_api_metadata] +[utility_all] openstack1 - -[nova_api_os_compute] -openstack1 - -[nova_cert] -openstack1 - -[nova_compute] -localhost - -[nova_conductor] -openstack1 - -[nova_console] -openstack1 - -[nova_scheduler] -openstack1 - -[nova_all:children] -nova_api_metadata -nova_api_os_compute -nova_cert -nova_compute -nova_conductor -nova_console -nova_scheduler diff --git a/tests/lxb_inventory b/tests/lxb_inventory index cea5e5a7..c07fc244 100644 --- a/tests/lxb_inventory +++ b/tests/lxb_inventory @@ -66,32 +66,5 @@ neutron_lbaas_agent neutron_metadata_agent neutron_server -[nova_api_metadata] +[utility_all] openstack1 - -[nova_api_os_compute] -openstack1 - -[nova_cert] -openstack1 - -[nova_compute] -localhost - -[nova_conductor] -openstack1 - -[nova_console] -openstack1 - -[nova_scheduler] -openstack1 - -[nova_all:children] -nova_api_metadata -nova_api_os_compute -nova_cert -nova_compute -nova_conductor -nova_console -nova_scheduler diff --git a/tests/ovs_inventory b/tests/ovs_inventory index 2fd77324..035b21f4 100644 --- a/tests/ovs_inventory +++ b/tests/ovs_inventory @@ -66,32 +66,5 @@ neutron_lbaas_agent neutron_metadata_agent neutron_server -[nova_api_metadata] +[utility_all] openstack1 - -[nova_api_os_compute] -openstack1 - -[nova_cert] -openstack1 - -[nova_compute] -localhost - -[nova_conductor] -openstack1 - -[nova_console] -openstack1 - -[nova_scheduler] -openstack1 - -[nova_all:children] -nova_api_metadata -nova_api_os_compute -nova_cert -nova_compute -nova_conductor -nova_console -nova_scheduler diff --git a/tests/test-neutron-functional.yml b/tests/test-neutron-functional.yml index 09a9b06a..e237d796 100644 --- a/tests/test-neutron-functional.yml +++ b/tests/test-neutron-functional.yml @@ -21,115 +21,14 @@ user: root gather_facts: true tasks: - - name: Install testing pip packages - pip: - name: "{{ item }}" - with_items: - - python-neutronclient - - httplib2 - - - name: Check the neutron api - uri: - url: "http://localhost:9696" - status_code: 200 - - # No assertion around this yet, just useful for debug purposes - # TODO(automagically) - Test for all expected agents and agent status - - name: Neutron agents status + - name: Run tempest shell: | - . /root/openrc - neutron agent-list - register: agent_list - - - name: Ensure that the DHCP agent is alive - shell: | - . /root/openrc - neutron agent-list | grep DHCP - register: neutron_dhcp_agent - until: neutron_dhcp_agent.stdout.find(':-)') != -1 - when: - - groups['neutron_dhcp_agent'] | length > 0 - retries: 5 - delay: 10 - - - name: Create test network - neutron: - command: create_network - openrc_path: /root/openrc - net_name: test-network - - - name: Ensuring network is created correctly - shell: | - . /root/openrc - neutron net-list -c id -c name -f value | grep test-network - register: neutron_net_list - until: neutron_net_list.rc == 0 - retries: 10 - delay: 3 - - - name: Create test subnet - shell: | - . /root/openrc - neutron subnet-create --name test-subnet test-network 192.168.74.0/24 - register: neutron_subnet_create - - - name: Debug test subnet output - debug: - msg: "{{ neutron_subnet_create.stdout_lines }}" - - - name: Ensuring subnet is created correctly - shell: | - . /root/openrc - neutron subnet-list -c id -c name -f value | grep test-subnet - register: neutron_subnet_list - until: neutron_subnet_list.rc == 0 - retries: 10 - delay: 3 - - # (andymccr): To avoid a race condition we can restart - # the neutron-dhcp-agent service: - # https://bugs.launchpad.net/openstack-ansible/+bug/1629346 - - name: Restart neutron-dhcp-agent service - service: - state: restarted - name: neutron-dhcp-agent - - - name: Ensure the dhcp agent is on the net - shell: | - . /root/openrc - neutron dhcp-agent-list-hosting-net '{{ neutron_net_list.stdout_lines[0].split(' ')[0] }}' | grep ":-)" - register: neutron_dhcp_agent_list - until: neutron_dhcp_agent_list.rc == 0 - retries: 10 - delay: 3 - - - name: Check for dhcp network namespace - shell: ip netns ls - register: dhcp_namespace - until: dhcp_namespace.stdout.find("qdhcp") != -1 - retries: 5 - delay: 10 - - - name: List the namespaces - debug: - msg: "{{ dhcp_namespace }}" - - - name: Make sure the dhcp namespace is present - assert: - that: - - "'qdhcp' in dhcp_namespace.stdout" - when: - - groups['neutron_dhcp_agent'] | length > 0 - - - name: Check for iptables checksum rule - shell: | - ip netns exec {{ dhcp_namespace.stdout.split(' ')[0] }} iptables -C neutron-dhcp-age-POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill - register: checksum_rule - until : checksum_rule.rc == 0 - retries: 5 - delay: 10 - when: - - groups['neutron_linuxbridge_agent'] | length > 0 + . {{ tempest_venv_bin }}/activate + {{ tempest_venv_bin | dirname }}/run_tempest.sh --no-virtual-env --serial tempest.api.network + register: run_tempest + until: run_tempest|success + retries: 3 + delay: 5 post_tasks: - include: test-calico-functional.yml diff --git a/tests/test.yml b/tests/test.yml index fcb2a731..d52aafeb 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -30,5 +30,8 @@ # Install Neutron - include: common/test-install-neutron.yml +# Install Tempest +- include: common/test-install-tempest.yml + # Run tests - include: test-neutron-functional.yml