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: Ie8402e2d9c3297e3bbee6065c9977890c4d46589
This commit is contained in:
Luigi Toscano 2020-08-18 17:21:06 +02:00
parent 019f79ec2e
commit d3ab74e495
5 changed files with 8 additions and 218 deletions

View File

@ -16,10 +16,13 @@
- job: - job:
name: muranoclient-functional-test-mysql-backend name: muranoclient-functional-test-mysql-backend
parent: legacy-dsvm-base parent: devstack-tox-functional
run: playbooks/legacy/muranoclient-functional-test-mysql-backend/run.yaml
post-run: playbooks/legacy/muranoclient-functional-test-mysql-backend/post.yaml
timeout: 4200 timeout: 4200
vars:
openrc_enable_export: true
devstack_plugins:
heat: https://opendev.org/openstack/heat
murano: https://opendev.org/openstack/murano
irrelevant-files: irrelevant-files:
- ^(test-|)requirements.txt$ - ^(test-|)requirements.txt$
- ^setup.cfg$ - ^setup.cfg$
@ -28,7 +31,6 @@
- ^releasenotes/.*$ - ^releasenotes/.*$
- ^muranoclient/tests/.*$ - ^muranoclient/tests/.*$
required-projects: required-projects:
- openstack/devstack-gate
- openstack/heat - openstack/heat
- openstack/murano - openstack/murano
- openstack/murano-dashboard - openstack/murano-dashboard

View File

@ -1,66 +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 MURANOCLIENT_DIR="$BASE/new/python-muranoclient"
sudo chown -R $USER:stack $MURANOCLIENT_DIR
# Get admin credentials
cd $BASE/new/devstack
source openrc admin admin
# Pass the appropriate variables via a config file
CREDS_FILE=$MURANOCLIENT_DIR/functional_creds.conf
cat <<EOF > $CREDS_FILE
# Credentials for functional testing
[auth]
uri = $OS_AUTH_URL
[admin]
user = $OS_USERNAME
tenant = $OS_TENANT_NAME
pass = $OS_PASSWORD
EOF
# Go to the muranoclient dir
cd $MURANOCLIENT_DIR
sudo chown -R $USER:stack $MURANOCLIENT_DIR
# Run tests
echo "Running muranoclient 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

View File

@ -33,7 +33,8 @@ class ClientTestBase(base.ClientTestBase):
self.username = os.environ.get('OS_USERNAME') self.username = os.environ.get('OS_USERNAME')
self.password = os.environ.get('OS_PASSWORD') self.password = os.environ.get('OS_PASSWORD')
self.tenant_name = os.environ.get('OS_TENANT_NAME') self.tenant_name = os.environ.get('OS_PROJECT_NAME',
os.environ.get('OS_TENANT_NAME'))
self.uri = os.environ.get('OS_AUTH_URL') self.uri = os.environ.get('OS_AUTH_URL')
config = configparser.RawConfigParser() config = configparser.RawConfigParser()
if config.read('functional_creds.conf'): if config.read('functional_creds.conf'):

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

View File

@ -1,67 +0,0 @@
- hosts: all
name: Autoconverted job legacy-muranoclient-dsvm-functional-mysql-backend from old
job gate-muranoclient-dsvm-functional-mysql-backend-ubuntu-xenial
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
export PYTHONUNBUFFERED=true
export DEVSTACK_GATE_NEUTRON=1
export DEVSTACK_PROJECT_FROM_GIT=python-muranoclient
export BRANCH_OVERRIDE=default
export ENABLED_SERVICES=tempest
export PROJECTS="openstack/heat $PROJECTS"
export PROJECTS="openstack/python-heatclient $PROJECTS"
export PROJECTS="openstack/murano $PROJECTS"
export PROJECTS="openstack/murano-dashboard $PROJECTS"
export KEEP_LOCALRC=1
# Enable murano devstack plugin. Provided repo should be cloned by zuul before devstack run
# and below provided link should not be used.
export DEVSTACK_LOCAL_CONFIG="enable_plugin heat https://opendev.org/openstack/heat"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin murano https://opendev.org/openstack/murano"
if [ "mysql-backend" = "glare-backend" ]; then
export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_service g-glare"
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MURANO_USE_GLARE=True"
fi
if [ "$BRANCH_OVERRIDE" != "default" ] ; then
export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
fi
function post_test_hook {
# Configure and run functional tests
/opt/stack/new/python-muranoclient/muranoclient/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 }}'