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: Ie8402e2d9c3297e3bbee6065c9977890c4d46589
tags/2.1.1^0
Luigi Toscano 1 month ago
parent
commit
d3ab74e495
5 changed files with 8 additions and 218 deletions
  1. +6
    -4
      .zuul.yaml
  2. +0
    -66
      muranoclient/tests/functional/hooks/post_test_hook.sh
  3. +2
    -1
      muranoclient/tests/functional/muranoclient.py
  4. +0
    -80
      playbooks/legacy/muranoclient-functional-test-mysql-backend/post.yaml
  5. +0
    -67
      playbooks/legacy/muranoclient-functional-test-mysql-backend/run.yaml

+ 6
- 4
.zuul.yaml View File

@@ -16,10 +16,13 @@

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


+ 0
- 66
muranoclient/tests/functional/hooks/post_test_hook.sh 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

+ 2
- 1
muranoclient/tests/functional/muranoclient.py View File

@@ -33,7 +33,8 @@ class ClientTestBase(base.ClientTestBase):

self.username = os.environ.get('OS_USERNAME')
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')
config = configparser.RawConfigParser()
if config.read('functional_creds.conf'):


+ 0
- 80
playbooks/legacy/muranoclient-functional-test-mysql-backend/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
- 67
playbooks/legacy/muranoclient-functional-test-mysql-backend/run.yaml 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 }}'

Loading…
Cancel
Save