From bb22add60c5d7a206ed8023d78fd155e256253a0 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Wed, 19 Aug 2020 12:22:38 +0200 Subject: [PATCH] Native Zuul v3 version of the functional legacy job Pretty straightforward conversion, and remove the old scripts which are not needed anymore. Also, even though OS_TENANT_NAME is still exported, read OS_PROJECT_NAME as first choice. Depends-On: https://review.opendev.org/746235 Change-Id: I51314da6d6bf0467308f3598fa9e666655e286d0 --- .zuul.yaml | 16 ++-- heatclient/tests/functional/base.py | 3 +- .../tests/functional/hooks/post_test_hook.sh | 50 ------------ playbooks/devstack/functional-post.yaml | 80 ------------------- playbooks/devstack/functional-run.yaml | 56 ------------- 5 files changed, 13 insertions(+), 192 deletions(-) delete mode 100755 heatclient/tests/functional/hooks/post_test_hook.sh delete mode 100644 playbooks/devstack/functional-post.yaml delete mode 100644 playbooks/devstack/functional-run.yaml diff --git a/.zuul.yaml b/.zuul.yaml index c5622cb6..03768ffa 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,15 +1,21 @@ - job: name: heatclient-functional - parent: legacy-dsvm-base - run: playbooks/devstack/functional-run.yaml - post-run: playbooks/devstack/functional-post.yaml + parent: devstack-tox-functional timeout: 4200 required-projects: - - openstack/devstack-gate - openstack/heat - openstack/python-heatclient vars: - branch_override: default + openrc_enable_export: true + devstack_plugins: + heat: https://opendev.org/openstack/heat + irrelevant-files: + - ^(test-|)requirements.txt$ + - ^setup.cfg$ + - ^doc/.*$ + - ^.*\.rst$ + - ^releasenotes/.*$ + - ^heatclient/tests/.*$ - project: templates: diff --git a/heatclient/tests/functional/base.py b/heatclient/tests/functional/base.py index bfa82b92..76ba4040 100644 --- a/heatclient/tests/functional/base.py +++ b/heatclient/tests/functional/base.py @@ -34,7 +34,8 @@ class ClientTestBase(base.ClientTestBase): return base.CLIClient( username=os.environ.get('OS_USERNAME'), password=os.environ.get('OS_PASSWORD'), - tenant_name=os.environ.get('OS_TENANT_NAME'), + tenant_name=os.environ.get('OS_PROJECT_NAME', + os.environ.get('OS_TENANT_NAME')), uri=os.environ.get('OS_AUTH_URL'), cli_dir=cli_dir) diff --git a/heatclient/tests/functional/hooks/post_test_hook.sh b/heatclient/tests/functional/hooks/post_test_hook.sh deleted file mode 100755 index afce9af6..00000000 --- a/heatclient/tests/functional/hooks/post_test_hook.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -xe - -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# This script is executed inside post_test_hook function in devstack gate. - -function generate_testr_results { - if [ -f .testrepository/0 ]; then - sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit - sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit - sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html - sudo gzip -9 $BASE/logs/testrepository.subunit - sudo gzip -9 $BASE/logs/testr_results.html - sudo chown $USER:$USER $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz - fi -} - -export HEATCLIENT_DIR="$BASE/new/python-heatclient" - -# Get admin credentials -cd $BASE/new/devstack -source openrc admin admin - -# Go to the heatclient dir -cd $HEATCLIENT_DIR - -sudo chown -R $USER:stack $HEATCLIENT_DIR - -# Run tests -echo "Running heatclient functional test suite" -set +e -# Preserve env for OS_ credentials -sudo -E -H -u $USER tox -efunctional -EXIT_CODE=$? -set -e - -# Collect and parse result -generate_testr_results -exit $EXIT_CODE diff --git a/playbooks/devstack/functional-post.yaml b/playbooks/devstack/functional-post.yaml deleted file mode 100644 index dac87534..00000000 --- a/playbooks/devstack/functional-post.yaml +++ /dev/null @@ -1,80 +0,0 @@ -- hosts: primary - tasks: - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*nose_results.html - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*testr_results.html.gz - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/.testrepository/tmp* - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=**/*testrepository.subunit.gz - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}/tox' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/.tox/*/log/* - - --include=*/ - - --exclude=* - - --prune-empty-dirs - - - name: Copy files from {{ ansible_user_dir }}/workspace/ on node - synchronize: - src: '{{ ansible_user_dir }}/workspace/' - dest: '{{ zuul.executor.log_root }}' - mode: pull - copy_links: true - verify_host: true - rsync_opts: - - --include=/logs/** - - --include=*/ - - --exclude=* - - --prune-empty-dirs diff --git a/playbooks/devstack/functional-run.yaml b/playbooks/devstack/functional-run.yaml deleted file mode 100644 index 7c2f2afe..00000000 --- a/playbooks/devstack/functional-run.yaml +++ /dev/null @@ -1,56 +0,0 @@ -- hosts: all - name: Job for heatclient-functional - tasks: - - - name: Ensure legacy workspace directory - file: - path: '{{ ansible_user_dir }}/workspace' - state: directory - - - shell: - cmd: | - set -e - set -x - cat > clonemap.yaml << EOF - clonemap: - - name: openstack/devstack-gate - dest: devstack-gate - EOF - /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \ - https://opendev.org \ - openstack/devstack-gate - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - cat << 'EOF' >>"/tmp/dg-local.conf" - [[local|localrc]] - enable_plugin heat https://opendev.org/openstack/heat - EOF - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}' - - - shell: - cmd: | - set -e - set -x - export PYTHONUNBUFFERED=true - export DEVSTACK_PROJECT_FROM_GIT=python-heatclient - if [ "{{ branch_override }}" != "default" ] ; then - export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE - fi - function post_test_hook { - # Configure and run functional tests - $BASE/new/python-heatclient/heatclient/tests/functional/hooks/post_test_hook.sh - } - export -f post_test_hook - cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh - ./safe-devstack-vm-gate-wrap.sh - executable: /bin/bash - chdir: '{{ ansible_user_dir }}/workspace' - environment: '{{ zuul | zuul_legacy_vars }}'