From 646ddd9947d60bf36615a4eaaaa97ea102efab9c Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 17 Mar 2020 20:28:59 -0400 Subject: [PATCH] Updated functional tests to use DevStack Depends-On: https://review.opendev.org/713560 Depends-On: https://review.opendev.org/713723 Change-Id: I2bd81bbf03e37ae215f3a12051914ac72da1261f --- .zuul.yaml | 8 +++- playbooks/functional/devstack.yaml | 56 +++++++++++++++++++++++ playbooks/functional/post.yaml | 3 ++ playbooks/functional/pre.yaml | 6 +++ playbooks/functional/run.yaml | 4 +- playbooks/functional/tests/memcached.yaml | 6 +++ 6 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 playbooks/functional/devstack.yaml create mode 100644 playbooks/functional/post.yaml create mode 100644 playbooks/functional/pre.yaml diff --git a/.zuul.yaml b/.zuul.yaml index bdf2ca37..8ef83c50 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -58,11 +58,15 @@ - job: name: openstack-operator:functional - parent: apply-helm-charts - requires: + parent: devstack-tempest + requires: - openstack-operator:images + pre-run: playbooks/functional/pre.yaml run: playbooks/functional/run.yaml + post-run: playbooks/functional/post.yaml vars: + devstack_services: + etcd3: false docker_use_buildset_registry: true minikube_dns_resolvers: ['1.1.1.1', '8.8.8.8'] diff --git a/playbooks/functional/devstack.yaml b/playbooks/functional/devstack.yaml new file mode 100644 index 00000000..90ef45b6 --- /dev/null +++ b/playbooks/functional/devstack.yaml @@ -0,0 +1,56 @@ +- hosts: all + tasks: + - name: Get Memcached IP address + command: kubectl get svc/mcrouter-memcached-sample -o=jsonpath='{.spec.clusterIP}' + register: _memcached_ip + # NOTE(mnaser): We need to rewrite the devstack local.conf because it happens + # inside pre.yaml right now. This should all be gone once the + # operator can deploy OpenStack entirely by itself. + - name: Gather minimum local MTU + set_fact: + local_mtu: > + {% set mtus = [] -%} + {% for interface in ansible_interfaces -%} + {% set interface_variable = 'ansible_' + interface -%} + {% if interface_variable in hostvars[inventory_hostname] -%} + {% set _ = mtus.append(hostvars[inventory_hostname][interface_variable]['mtu']|int) -%} + {% endif -%} + {% endfor -%} + {{- mtus|min -}} + - name: Calculate external_bridge_mtu + # 50 bytes is overhead for vxlan (which is greater than GRE + # allowing us to use either overlay option with this MTU. + # TODO(andreaf) This should work, but it may have to be reconcilied with + # the MTU setting used by the multinode setup roles in multinode pre.yaml + set_fact: + external_bridge_mtu: "{{ local_mtu | int - 50 }}" + - name: Define additional devstack_localrc values + set_fact: + _devstack_localrc: "{{ devstack_localrc }}" + _devstack_localrc_extra: + MEMCACHE_SERVERS: "{{ _memcached_ip.stdout }}:11211" + - name: Re-write local.conf + include_role: + name: write-devstack-local-conf + vars: + devstack_localrc: "{{ _devstack_localrc | combine(_devstack_localrc_extra) }}" + +# Changes that run through devstack-tempest are likely to have an impact on +# the devstack part of the job, so we keep devstack in the main play to +# avoid zuul retrying on legitimate failures. +- hosts: all + roles: + - orchestrate-devstack + +# We run tests only on one node, regardless how many nodes are in the system +- hosts: tempest + environment: + # This enviroment variable is used by the optional tempest-gabbi + # job provided by the gabbi-tempest plugin. It can be safely ignored + # if that plugin is not being used. + GABBI_TEMPEST_PATH: "{{ gabbi_tempest_path | default('') }}" + roles: + - setup-tempest-run-dir + - setup-tempest-data-dir + - acl-devstack-files + - run-tempest \ No newline at end of file diff --git a/playbooks/functional/post.yaml b/playbooks/functional/post.yaml new file mode 100644 index 00000000..6a8735c4 --- /dev/null +++ b/playbooks/functional/post.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - collect-container-logs \ No newline at end of file diff --git a/playbooks/functional/pre.yaml b/playbooks/functional/pre.yaml new file mode 100644 index 00000000..afcbabfc --- /dev/null +++ b/playbooks/functional/pre.yaml @@ -0,0 +1,6 @@ +--- +- hosts: all + roles: + - role: clear-firewall + - role: install-kubernetes + - role: ensure-helm \ No newline at end of file diff --git a/playbooks/functional/run.yaml b/playbooks/functional/run.yaml index d0e6f92f..581c51b6 100644 --- a/playbooks/functional/run.yaml +++ b/playbooks/functional/run.yaml @@ -6,4 +6,6 @@ helm_chart: ./chart tasks: # TODO(mnaser): Generate all manifests and ensure git is not dirty - - include_tasks: tests/memcached.yaml \ No newline at end of file + - include_tasks: tests/memcached.yaml + +- import_playbook: devstack.yaml \ No newline at end of file diff --git a/playbooks/functional/tests/memcached.yaml b/playbooks/functional/tests/memcached.yaml index 915bf435..7401f901 100644 --- a/playbooks/functional/tests/memcached.yaml +++ b/playbooks/functional/tests/memcached.yaml @@ -19,6 +19,9 @@ return_content: yes register: _metrics loop: "{{ _memcached_ips.stdout_lines }}" + until: _metrics is success + retries: 10 + delay: 5 failed_when: "'memcached_up 1' not in _metrics.content" - name: Get all pod IPs for Mcrouter @@ -35,4 +38,7 @@ return_content: yes register: _metrics loop: "{{ _mcrouter_ips.stdout_lines }}" + until: _metrics is success + retries: 10 + delay: 5 failed_when: "'mcrouter_up 1' not in _metrics.content" \ No newline at end of file