Browse Source

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
tags/2.2.1^0
Luigi Toscano 1 month ago
parent
commit
bb22add60c
5 changed files with 13 additions and 192 deletions
  1. +11
    -5
      .zuul.yaml
  2. +2
    -1
      heatclient/tests/functional/base.py
  3. +0
    -50
      heatclient/tests/functional/hooks/post_test_hook.sh
  4. +0
    -80
      playbooks/devstack/functional-post.yaml
  5. +0
    -56
      playbooks/devstack/functional-run.yaml

+ 11
- 5
.zuul.yaml View File

@@ -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:


+ 2
- 1
heatclient/tests/functional/base.py View File

@@ -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)



+ 0
- 50
heatclient/tests/functional/hooks/post_test_hook.sh View File

@@ -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

+ 0
- 80
playbooks/devstack/functional-post.yaml View File

@@ -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

+ 0
- 56
playbooks/devstack/functional-run.yaml View File

@@ -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 }}'

Loading…
Cancel
Save