From 4e38b1751ad64079f616e7a823087ee8cb839c15 Mon Sep 17 00:00:00 2001 From: Vladimir Khlyunev Date: Thu, 11 Apr 2019 14:42:59 +0400 Subject: [PATCH] Initial tempest commit Change-Id: If499b677833b911eb266b81303307072bf2bcb71 --- maintenance-ci/mos/jobs/9.x.tempest.yaml | 39 +++ .../mos/jobs/maintenance-tempest-report.yaml | 69 ++++++ .../mos/jobs/maintenance-tempest-runner.yaml | 71 ++++++ .../mos/jobs/tempest.create_env.yaml | 100 ++++++++ maintenance-ci/mos/jobs/tempest.yaml | 97 ++++++++ .../mos/scripts/maintenance-tempest-report.sh | 72 ++++++ .../mos/scripts/maintenance-tempest-runner.sh | 223 ++++++++++++++++++ .../mos/scripts/tempest.create_env.sh | 83 +++++++ .../mos/templates/tempest.multijob.yaml | 116 +++++++++ maintenance-ci/views/9.x.tempest.yaml | 2 +- 10 files changed, 871 insertions(+), 1 deletion(-) create mode 100644 maintenance-ci/mos/jobs/9.x.tempest.yaml create mode 100644 maintenance-ci/mos/jobs/maintenance-tempest-report.yaml create mode 100644 maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml create mode 100644 maintenance-ci/mos/jobs/tempest.create_env.yaml create mode 100644 maintenance-ci/mos/jobs/tempest.yaml create mode 100644 maintenance-ci/mos/scripts/maintenance-tempest-report.sh create mode 100644 maintenance-ci/mos/scripts/maintenance-tempest-runner.sh create mode 100644 maintenance-ci/mos/scripts/tempest.create_env.sh create mode 100644 maintenance-ci/mos/templates/tempest.multijob.yaml diff --git a/maintenance-ci/mos/jobs/9.x.tempest.yaml b/maintenance-ci/mos/jobs/9.x.tempest.yaml new file mode 100644 index 0000000..0540dec --- /dev/null +++ b/maintenance-ci/mos/jobs/9.x.tempest.yaml @@ -0,0 +1,39 @@ +- project: + name: 9.x.tempest.lvm.no_ssl + specification: ironic_cinder_nossl + config_path: templates/tempest/ironic_cinder.yaml + test-group: 'Tempest (LVM,Cinder,DVR,Sahara,Ceilometer,Ironic)' + description: 'Tempest-9.x_LVM_Cinder_DVR_Sahara_Ceilometer_Ironic' + ssl_disabled: true + jobs: + - mos/templates/tempest_multijob + +- project: + name: 9.x.tempest.ceph.no_ssl + specification: ironic_ceph_nossl + config_path: templates/tempest/ironic_ceph.yaml + test-group: 'Tempest (Ceph,DVR,Sahara,Ceilometer)' + description: 'Tempest-9.x_Ceph_DVR_Sahara_Ceilometer_Ironic' + ssl_disabled: true + jobs: + - mos/templates/tempest_multijob + +- project: + name: 9.x.tempest.lvm.ssl + specification: ironic_cinder_ssl + config_path: templates/tempest/ironic_cinder.yaml + test-group: 'Tempest (SSL,LVM,Cinder,DVR,Sahara,Ceilometer,Ironic)' + description: 'Tempest-9.x_LVM_Cinder_DVR_Sahara_Ceilometer_Ironic_SSL' + ssl_disabled: false + jobs: + - mos/templates/tempest_multijob + +- project: + name: 9.x.tempest.ceph.ssl + specification: ironic_ceph_ssl + config_path: templates/tempest/ironic_ceph.yaml + test-group: 'Tempest (Ceph,SSL,DVR,Sahara,Ceilometer)' + description: 'Tempest-9.x_Ceph_DVR_Sahara_Ceilometer_Ironic_SSL' + ssl_disabled: false + jobs: + - mos/templates/tempest_multijob diff --git a/maintenance-ci/mos/jobs/maintenance-tempest-report.yaml b/maintenance-ci/mos/jobs/maintenance-tempest-report.yaml new file mode 100644 index 0000000..1561e25 --- /dev/null +++ b/maintenance-ci/mos/jobs/maintenance-tempest-report.yaml @@ -0,0 +1,69 @@ +- job: + name: 'maintenance-tempest-report' + description: 'Send XUnit reports to TestRail' + build-discarder: + daysToKeep: 5 + numToKeep: 12 + artifactDaysToKeep: 5 + artifactNumToKeep: 12 + properties: + - heavy-job: + weight: 1 + parameters: + - node: + name: NODE_LABELS + default: "mos-tempest" + - string: + name: REPORT_FILE + default: /home/jenkins/report.xml + - string: + name: TESTRAIL_PLAN_NAME + - string: + name: TEST_GROUP + - string: + name: TESTRAIL_PROJECT + default: "Mirantis OpenStack" + - string: + name: TEST_BUILD_URL + - string: + name: TESTRAIL_SUITE + - string: + name: MILESTONE + - string: + name: SPECIFICATION + - bool: + name: ADD_TIMESTAMP + default: true + - string: + name: TIMESTAMP + description: | + Timestamp to add to test plan name. Generally should be inherited from runner job. + If empty - 'date' command will be used + - bool: + name: USE_TEMPLATE + default: true + - bool: + name: SEND_SKIPPED + default: false + wrappers: + - credentials-binding: + - username-password-separated: + credential-id: testrail_credentials + username: TESTRAIL_USER + password: TESTRAIL_PASSWORD + scm: + - git: + url: https://github.com/dis-xcom/testrail_reporter.git + branches: + - origin/master + builders: + - shell: + !include-raw: '../scripts/maintenance-tempest-report.sh' + publishers: + - workspace-cleanup: + fail-build: false + - description-setter: + regexp: ^.*\[TestRun URL\]\s*(.*) + regexp-for-failed: ^.*\[TestRun URL\]\s*(.*) + description: TestRail Report URL + description-for-failed: TestRail Report URL diff --git a/maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml b/maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml new file mode 100644 index 0000000..238538d --- /dev/null +++ b/maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml @@ -0,0 +1,71 @@ +- job: + name: maintenance-tempest-runner + description: 'Runs Tempest tests' + build-discarder: + daysToKeep: 5 + numToKeep: 20 + artifactDaysToKeep: 5 + artifactNumToKeep: 20 + properties: + - heavy-job: + weight: 1 + scm: + - git: + url: "https://review.fuel-infra.org/fuel-infra/dockerfiles" + branches: + - "origin/master" + skip-tag: true + - git: + url: "https://github.com/Mirantis/mos-ci-deployment-scripts.git" + branches: + - 'origin/master' + basedir: 'mos-ci-deployment-scripts' + parameters: + - node: + name: NODE_LABELS + default: "mos-tempest" + - string: + name: ENV_NAME + - string: + name: SNAPSHOT_NAME + - string: + name: VENV_PATH + default: /home/jenkins/qa-venv-9.x + - choice: + name: TEMPEST_RUNNER + choices: + - 'mos-tempest-runner' + - 'rally' + - 'rally_without_docker' + description: | + mos-tempest-runner for 7.0 + rally for 8.0 + rally_without_docker for 9.x + - string: + name: MILESTONE + default: '7.0' + - string: + name: REPORT_PREFIX + description: directory, where verification.xml will been copyed + builders: + - shell: + !include-raw: '../scripts/maintenance-tempest-runner.sh' + publishers: + - archive: + artifacts: 'log.log' + allow-empty: 'true' + fingerprint: true + - archive: + artifacts: 'verification.xml' + allow-empty: 'true' + fingerprint: true + - archive: + artifacts: 'tempest.log' + allow-empty: 'true' + fingerprint: true + - archive: + artifacts: 'tempest.conf' + allow-empty: 'true' + fingerprint: true + - junit: + results: verification.xml diff --git a/maintenance-ci/mos/jobs/tempest.create_env.yaml b/maintenance-ci/mos/jobs/tempest.create_env.yaml new file mode 100644 index 0000000..b7c01bc --- /dev/null +++ b/maintenance-ci/mos/jobs/tempest.create_env.yaml @@ -0,0 +1,100 @@ +- job: + name: 9.x.tempest.create_env + description: 'Create environment with parameters. Usable for tempest.' + build-discarder: + daysToKeep: 7 + numToKeep: 12 + artifactDaysToKeep: 7 + artifactNumToKeep: 12 + properties: + - heavy-job: + weight: 1 + parameters: + - node: + name: NODE_LABEL + default-slaves: + - mos-tempest + - string: + name: ENV_NAME + default: 'maintenance_env_9.x' + description: 'devops environment name' + - string: + name: SNAPSHOT_PARAMS_ID + default: lastSuccessfulBuild + description: | + Take from https://maintenance-ci.scc.mirantis.net/job/9.x.snapshot.params/ + for last build: lastSuccessfulBuild + - string: + name: MAGNET_LINK_OVERWRITE + description: "Which ISO to use in tests" + default: !include-raw: ../data/9.0-iso + - text: + name: MOS_MIRROR_OVERWRITES + description: "Set of variables to inject to job; add new parameters if needed for run" + default: | + ENABLE_MOS_CENTOS_OS=true + ENABLE_MOS_CENTOS_PROPOSED=true + ENABLE_MOS_CENTOS_UPDATES=true + ENABLE_MOS_CENTOS_SECURITY=true + ENABLE_MOS_CENTOS_HOLDBACK=true + ENABLE_MOS_CENTOS_HOTFIX=false + MOS_CENTOS_OS_MIRROR_ID_OVERWRITE= + MOS_CENTOS_PROPOSED_MIRROR_ID_OVERWRITE= + MOS_CENTOS_UPDATES_MIRROR_ID_OVERWRITE= + MOS_CENTOS_SECURITY_MIRROR_ID_OVERWRITE= + MOS_CENTOS_HOLDBACK_MIRROR_ID_OVERWRITE= + MOS_CENTOS_HOTFIX_MIRROR_ID_OVERWRITE= + # + MOS_UBUNTU_MIRROR_ID_OVERWRITE= + ENABLE_MOS_UBUNTU_PROPOSED=true + ENABLE_MOS_UBUNTU_UPDATES=true + ENABLE_MOS_UBUNTU_SECURITY=true + ENABLE_MOS_UBUNTU_HOLDBACK=true + ENABLE_MOS_UBUNTU_HOTFIX=false + UBUNTU_MIRROR_ID_OVERWRITE= + CENTOS_MIRROR_ID_OVERWRITE= + - bool: + name: UPDATE_MASTER_VIA_MOS_MU + default: true + description: 'true - =9.2, false - <=9.1' + - string: + name: INTERFACE_MODEL + default: virtio + - string: + name: ERASE_ENV_PREFIX + description: 'If not empty, then erase all environments with this prefix' + - bool: + name: DISABLE_SSL + default: false + - string: + name: CONFIG_PATH + description: 'Config for deploy from mos-ci-deployment-scripts' + - string: + name: VENV_PATH + default: "/home/jenkins/qa-venv-9.x" + - string: + name: SNAPSHOT_NAME + default: "after_deploy" + - bool: + name: NOVA_QUOTAS + default: true + - string: + name: FUEL_QA_GERRIT_REVIEW + description: "gerrit review num" + default: "" + scm: + - git: + url: 'https://review.fuel-infra.org/openstack/fuel-qa.git' + branches: + - 'origin/stable/mitaka' + basedir: '' + builders: + - inject-text-parameter: + properties-content: $MOS_MIRROR_OVERWRITES + - guess-mirror + - 9x-systest-repos-parsing + - shell: + !include-raw: '../scripts/tempest.create_env.sh' + publishers: + - workspace-cleanup: + fail-build: false diff --git a/maintenance-ci/mos/jobs/tempest.yaml b/maintenance-ci/mos/jobs/tempest.yaml new file mode 100644 index 0000000..4da1b70 --- /dev/null +++ b/maintenance-ci/mos/jobs/tempest.yaml @@ -0,0 +1,97 @@ +- job: + name: 9.x.tempest + project-type: multijob + description: 'Run 9.2 tempest tests' + concurrent: false + node: 'jenkins-master' + properties: + - heavy-job: + weight: 1 + parameters: + - string: + name: TESTRAIL_PLAN_NAME + default: '9.2 MU-X Tempest' + - string: + name: SNAPSHOT_PARAMS_ID + default: lastSuccessfulBuild + description: | + Take from https://patching-ci.infra.mirantis.net/job/9.x.snapshot.params/ + - string: + name: FUEL_QA_GERRIT_REVIEW + description: "gerrit review num" + default: "" + - text: + name: MOS_MIRROR_OVERWRITES + description: "Set of variables to inject to job; add new parameters if needed for run" + default: | + ENABLE_MOS_CENTOS_OS=true + ENABLE_MOS_CENTOS_PROPOSED=true + ENABLE_MOS_CENTOS_UPDATES=true + ENABLE_MOS_CENTOS_SECURITY=true + ENABLE_MOS_CENTOS_HOLDBACK=true + ENABLE_MOS_CENTOS_HOTFIX=false + MOS_CENTOS_OS_MIRROR_ID_OVERWRITE= + MOS_CENTOS_PROPOSED_MIRROR_ID_OVERWRITE= + MOS_CENTOS_UPDATES_MIRROR_ID_OVERWRITE= + MOS_CENTOS_SECURITY_MIRROR_ID_OVERWRITE= + MOS_CENTOS_HOLDBACK_MIRROR_ID_OVERWRITE= + MOS_CENTOS_HOTFIX_MIRROR_ID_OVERWRITE= + # + MOS_UBUNTU_MIRROR_ID_OVERWRITE= + ENABLE_MOS_UBUNTU_PROPOSED=true + ENABLE_MOS_UBUNTU_UPDATES=true + ENABLE_MOS_UBUNTU_SECURITY=true + ENABLE_MOS_UBUNTU_HOLDBACK=true + ENABLE_MOS_UBUNTU_HOTFIX=false + UBUNTU_MIRROR_ID_OVERWRITE= + CENTOS_MIRROR_ID_OVERWRITE= + - string: + name: INTERFACE_MODEL + default: virtio + description: 'virtio, e1000' + - bool: + name: ADD_TIMESTAMP + default: true + - dynamic-string: + name: TIMESTAMP + script: | + TimeZone.setDefault(TimeZone.getTimeZone('UTC')) + def now = new Date() + return now.format("yyyy-MM-dd") + remote: false + - string: + name: FUEL_QA_VER + default: "origin/stable/mitaka" + - string: + name: VENV_PATH + default: "/home/jenkins/qa-venv-9.x" + builders: + - shell: + echo "TIMESTAMP=$(date +%Y/%m/%d)" > timestamp.sh + - inject-properties-file: + properties-file: timestamp.sh + - multijob: + name: 'Run 9.x tempest' + condition: COMPLETED + projects: + - name: '9.x.tempest.ironic_ceph_nossl' + current-parameters: true + predefined-parameters: TIMESTAMP=${TIMESTAMP} + abort-all-job: true + kill-phase-on: NEVER + - name: '9.x.tempest.ironic_cinder_nossl' + current-parameters: true + predefined-parameters: TIMESTAMP=${TIMESTAMP} + abort-all-job: true + kill-phase-on: NEVER + - name: '9.x.tempest.ironic_ceph_ssl' + current-parameters: true + abort-all-job: true + predefined-parameters: TIMESTAMP=${TIMESTAMP} + kill-phase-on: NEVER + - name: '9.x.tempest.ironic_cinder_ssl' + current-parameters: true + abort-all-job: true + predefined-parameters: TIMESTAMP=${TIMESTAMP} + kill-phase-on: NEVER + diff --git a/maintenance-ci/mos/scripts/maintenance-tempest-report.sh b/maintenance-ci/mos/scripts/maintenance-tempest-report.sh new file mode 100644 index 0000000..7297eb7 --- /dev/null +++ b/maintenance-ci/mos/scripts/maintenance-tempest-report.sh @@ -0,0 +1,72 @@ +#!/bin/bash -ex + +# Input: +# REPORT_FILE=xml report file name +# TESTRAIL_PLAN_NAME=name of testplan on testrail (Tempest MU8 05-32-2017) +# TEST_GROUP=tempest configuration group +# TESTRAIL_PROJECT=testrail project (Mirantis OpenStack) +# TESTRAIL_SUITE=testrail suite (Tempest 7.0) +# MILESTONE=7.0 +# SPECIFICATION=snapshot for describe env in testrail +# ADD_TIMESTAMP=need add timestamp to plan name +# USE_TEMPLATE=use testrail report template or not + +if [ ! -f "${REPORT_FILE?}" ]; then + echo "Can't find \"${REPORT_FILE}\" report file" + exit 1 +fi + +TESTRAIL_SUITE=${TESTRAIL_SUITE:-"Tempest ${MILESTONE}"} +SEND_SKIPPED=${SEND_SKIPPED:-false} +USE_TEMPLATE=${USE_TEMPLATE:-false} + +if [[ "${ADD_TIMESTAMP}" == "true" ]]; then + if [[ -z "${TIMESTAMP}" ]] ; then + TIMESTAMP="$(date +%Y/%m/%d)" + fi + TESTRAIL_PLAN_NAME+="-${TIMESTAMP}" +fi + +ARGS=() +if [[ "${USE_TEMPLATE}" == "true" ]]; then + ARGS+=(--testrail-name-template '{custom_test_group}.{title}' --xunit-name-template '{classname}.{methodname}') +fi + +if [ -n "${TEST_GROUP}" ]; then + SPECIFICATION="${SPECIFICATION?}-${TEST_GROUP?}" +fi + +if [ -z "${TEST_BUILD_URL}" ]; then + TEST_BUILD_URL="${BUILD_URL}" +fi + +if [ "${SEND_SKIPPED}" == "true" ]; then + ARGS+=(--send-skipped) +fi + +if [ ! -f report-venv/bin/activate ]; then + rm -rf report-venv + virtualenv report-venv + source report-venv/bin/activate + pip install -U pip setuptools six # six need for workaround setup.py below + python setup.py install +else + source report-venv/bin/activate +fi + +report -v --testrail-plan-name "${TESTRAIL_PLAN_NAME?}" \ + --env-description "${SPECIFICATION?}"\ + --testrail-user "${TESTRAIL_USER?}" \ + --testrail-password "${TESTRAIL_PASSWORD?}" \ + --testrail-project "${TESTRAIL_PROJECT?}" \ + --testrail-milestone "${MILESTONE?}" \ + --testrail-suite "${TESTRAIL_SUITE?}" \ + --test-results-link "${TEST_BUILD_URL}" \ + "${ARGS[@]}" \ + "${REPORT_FILE?}" + +deactivate + +if [ -f "${REPORT_FILE}" ]; then + mv -f "${REPORT_FILE}" "${REPORT_FILE}.reported" +fi diff --git a/maintenance-ci/mos/scripts/maintenance-tempest-runner.sh b/maintenance-ci/mos/scripts/maintenance-tempest-runner.sh new file mode 100644 index 0000000..7f2be88 --- /dev/null +++ b/maintenance-ci/mos/scripts/maintenance-tempest-runner.sh @@ -0,0 +1,223 @@ +#!/bin/bash + +set -xe + +# Input: +# REPORT_PREFIX=path to report directory +# ENV_NAME=devops name +# SNAPSHOT_NAME=tempest group name +# MILESTONE=7.0 +# VENV_PATH=path to venv with devops +# TEMPEST_RUNNER=tempest runner type + +# clean previous results to prevent double-reporting of same run + +if [ -f "${REPORT_PREFIX}/verification.xml" ]; then + mv -f "${REPORT_PREFIX}/verification.xml" "${REPORT_PREFIX}/verification.xml.unreported" +fi +rm -rf log.log verification.xml tmepest.log tempest.conf + +source "${VENV_PATH}/bin/activate" + +MILESTONE_MAJOR=$(echo "${MILESTONE}" | cut -c 1) + +# retry 3 times, because dos.py is not stable sometimes (ntp problem) +for i in $(seq 3); do + if [ "${MILESTONE_MAJOR}" -ge "7" ]; then + dos.py revert-resume "${ENV_NAME}" "${SNAPSHOT_NAME}" && break + else + dos.py revert-resume "${ENV_NAME}" --snapshot-name "${SNAPSHOT_NAME}" && break + fi + echo "Revert-resume attempt $i is failed. Retrying..." + dos.py destroy "${ENV_NAME}" + sleep 15 +done + +VM_USERNAME="root" +VM_PASSWORD="r00tme" +VM_IP=$(dos.py list --ips|grep "${ENV_NAME}"|awk '{print $2}') + +deactivate + +SSH_OPTIONS=(-o "ConnectTimeout=20" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null") +ssh_to_fuel_master() { + # $1 - command to execute + sshpass -p "${VM_PASSWORD}" ssh "${SSH_OPTIONS[@]}" "${VM_USERNAME}@${VM_IP}" "$1" +} + +scp_to_fuel_master() { + # $1 - file, can be 'flagged' with --recursive + # $2 - target path + SCP_ARGS=() + case $1 in + -r|--recursive) + SCP_ARGS+="-r" + shift + ;; + esac + targetpath=$2 + sshpass -p "${VM_PASSWORD}" scp "${SSH_OPTIONS[@]}" "${SCP_ARGS[@]}" "$1" "${VM_USERNAME}@${VM_IP}:${targetpath:-\"/tmp/\"}" +} + +scp_from_fuel_master() { + # $1 - remote file, can be 'flagged' with --recursive + # $2 - local path + SCP_ARGS=() + case $1 in + -r|--recursive) + SCP_ARGS+="-r" + shift + ;; + esac + sshpass -p "${VM_PASSWORD}" scp "${SSH_OPTIONS[@]}" "${SCP_ARGS[@]}" "${VM_USERNAME}@${VM_IP}:$1" "$2" +} + +check_return_code_after_command_execution() { + if [ "$1" -ne 0 ]; then + if [ -n "$2" ]; then + echo "$2" + fi + exit 1 + fi +} + +enable_public_ip() { + source "${VENV_PATH}/bin/activate" + public_mac=$(virsh dumpxml "${ENV_NAME}_admin" | grep -B 1 "${ENV_NAME}_public" | awk -F"'" '{print $2}' | head -1) + public_ip=$(dos.py net-list "${ENV_NAME}" | awk '/public/{print $2}' | grep -E -o "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}") + public_net=$(dos.py net-list "${ENV_NAME}" | awk -F/ '/public/{print $2}') + deactivate + + ssh_to_fuel_master < ${WORK_FLDR}/log.log +EOF + + scp_from_fuel_master -r /home/developer/mos-tempest-runner/tempest-reports/* . + scp_from_fuel_master "${WORK_FLDR}/log.log" ./ + + mv tempest-report.xml verification.xml + set -e +elif [[ "${TEMPEST_RUNNER}" == "rally" ]]; then + # Workaround for run on master node. install dependencies for tempest commit b39bbce80c69a57c708ed1b672319f111c79bdd5 + sed -i 's|rally verify install --source /var/lib/tempest --no-tempest-venv|rally verify install --source /var/lib/tempest --system-wide --version b39bbce80c69a57c708ed1b672319f111c79bdd5|g' rally-tempest/latest/setup_tempest.sh + + sed -i 's|FROM rallyforge/rally:latest|FROM rallyforge/rally:0.5.0|g' rally-tempest/latest/Dockerfile + sed -i 's|RUN git clone https://git.openstack.org/openstack/tempest|RUN git clone https://git.openstack.org/openstack/tempest; cd tempest; git checkout b39bbce80c69a57c708ed1b672319f111c79bdd5|g' rally-tempest/latest/Dockerfile + sed -i 's|pip install tempest/|pip install -U -r requirements.txt|g' rally-tempest/latest/Dockerfile + + docker build -t rally-tempest rally-tempest/latest + docker save -o ./dimage rally-tempest + + scp_to_fuel_master dimage "${WORK_FLDR}/rally" + ssh_to_fuel_master "ln -sf ${WORK_FLDR}/rally /root/rally" + ssh_to_fuel_master "cd ${WORK_FLDR} && wget https://raw.githubusercontent.com/fuel-infra/jenkins-jobs/master/servers/patching-ci/builders/maintenance-tempest-rally-runner.sh" + ssh_to_fuel_master "chmod +x ${WORK_FLDR}/maintenance-tempest-rally-runner.sh" + + echo "Run tempest tests" + set +e + ssh_to_fuel_master "/bin/bash -xe ${WORK_FLDR}/maintenance-tempest-rally-runner.sh > ${WORK_FLDR}/log.log" + + scp_from_fuel_master /var/lib/rally-tempest-container-home-dir/verification.xml ./ + scp_from_fuel_master "${WORK_FLDR}/log.log" ./ + set -e +elif [[ "${TEMPEST_RUNNER}" == "rally_without_docker" ]]; then + scp_to_fuel_master mos-ci-deployment-scripts/jenkins-job-builder/shell_scripts/run_tempest_without_docker.sh "${WORK_FLDR}/tempest.sh" + + CONTROLLER_ID=$(ssh_to_fuel_master "fuel node | grep -m1 controller | awk '{print \$1}'") + ssh_to_fuel_master "scp ${WORK_FLDR}/tempest.sh node-${CONTROLLER_ID}:/root/tempest.sh" + + # Workaround for 'There are problems and -y was used without --force-yes problem' + ssh_to_fuel_master "ssh node-${CONTROLLER_ID} 'echo \"APT::Get::AllowUnauthenticated 1;\" >> /etc/apt/apt.conf.d/02allow-unathenticated'" + + echo "Run tempest tests" + set +e + ssh_to_fuel_master "ssh node-${CONTROLLER_ID} 'bash -xe /root/tempest.sh'" + + # collect logs + ssh_to_fuel_master "scp node-${CONTROLLER_ID}:/root/rally/verification.xml ${WORK_FLDR}/verification.xml" + ssh_to_fuel_master "scp node-${CONTROLLER_ID}:/root/rally/log.log ${WORK_FLDR}/log.log" + ssh_to_fuel_master "scp node-${CONTROLLER_ID}:/root/rally/tempest.conf ${WORK_FLDR}/tempest.conf" + ssh_to_fuel_master "scp node-${CONTROLLER_ID}:/root/rally/tempest.log ${WORK_FLDR}/tempest.log" + + scp_from_fuel_master "${WORK_FLDR}/verification.xml" ./ + scp_from_fuel_master "${WORK_FLDR}/log.log" ./log.log + scp_from_fuel_master "${WORK_FLDR}/tempest.conf" ./tempest.conf + scp_from_fuel_master "${WORK_FLDR}/tempest.log" ./tempest.log + set -e +else + echo "INVALID TEMPEST RUNNER '${TEMPEST_RUNNER}'" +fi + +set +e + +if [[ -n "${REPORT_PREFIX}" ]]; then + mkdir -p "${REPORT_PREFIX}" + cp -f verification.xml "${REPORT_PREFIX}" +fi + +source "${VENV_PATH}/bin/activate" +SNAPSHOT_NAME="after-tempest-${BUILD_ID}-$(date +%d-%m-%Y_%Hh_%Mm)" +dos.py snapshot "${ENV_NAME}" "${SNAPSHOT_NAME}" +dos.py destroy "${ENV_NAME}" +deactivate + diff --git a/maintenance-ci/mos/scripts/tempest.create_env.sh b/maintenance-ci/mos/scripts/tempest.create_env.sh new file mode 100644 index 0000000..5e2cac9 --- /dev/null +++ b/maintenance-ci/mos/scripts/tempest.create_env.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -ex + +# Input: +# ENV_NAME +# SNAPSHOT_PARAMS_ID +# MAGNET_LINK +# UPDATE_MASTER_VIA_MOS_MU +# INTERFACE_MODEL +# ERASE_ENV_PREFIX +# DISABLE_SSL +# CONFIG_PATH +# VENV_PATH +# SNAPSHOT_NAME +# NOVA_QUOTAS + +mkdir -p logs +rm -rf logs/* + +ISO_PATH=$(seedclient-wrapper -d -m "${MAGNET_LINK?}" -v --force-set-symlink -o "${WORKSPACE}") + +source "${VENV_PATH?}/bin/activate" + +export PYTHONPATH="${WORKSPACE}" + +pip install -U -r fuelweb_test/requirements.txt > logs/pip_install_output.log + +if [[ -n "${ERASE_ENV_PREFIX}" ]]; then + dos.py list | tail -n+3 | grep "${ERASE_ENV_PREFIX}" | xargs -I {} dos.py erase {} +fi + +# # # # # # # # # Tempest conf preparation # # # # # # # # # # # # # # # # # # # # # # # # # # +CONFIG_FILE=$(basename "${CONFIG_PATH}") +CONFIG_NAME="${CONFIG_FILE%.*}" + +KVM_USE=true +PLUGINS_CONFIG_PATH=$(pwd)/plugins.yaml +DEPLOYMENT_TIMEOUT=10000 +NOVA_QUOTAS_ENABLED="${NOVA_QUOTAS}" + +INTERFACE_PREFIX_CHANGE=true +if [ "${INTERFACE_MODEL?}" = 'virtio' ] ; then + # Virtio network interfaces have names eth0..eth5 + # (rather than default names - enp0s3..enp0s8) + for i in {0..5}; do + declare "IFACE_$i=eth$i" + export "IFACE_$i" + done +fi + +export INTERFACE_PREFIX_CHANGE ISO_PATH ENV_NAME DISABLE_SSL KVM_USE INTERFACE_MODEL PLUGINS_CONFIG_PATH DEPLOYMENT_TIMEOUT NOVA_QUOTAS_ENABLED + + +set +x +echo "======================================================" +echo "=====================ENV VARS=========================" +env +echo "======================================================" +echo "======================================================" +set -x +set +x +echo "======================================================" +echo "=====================MOS VARS=========================" +echo "UPDATE_FUEL_MIRROR: ${UPDATE_FUEL_MIRROR}" +echo "EXTRA_DEB_REPOS: ${EXTRA_DEB_REPOS}" +echo "======================================================" +echo "======================================================" +set -x + + +if [[ ! -z ${FUEL_QA_GERRIT_REVIEW} ]] ; then +refspec=$(curl "https://review.fuel-infra.org/changes/?q=${FUEL_QA_GERRIT_REVIEW}&o=CURRENT_REVISION" | grep '"ref":' | awk -F ": " '{print $2}' | tr -d '"') +git fetch https://review.fuel-infra.org/openstack/fuel-qa "${refspec}" && git cherry-pick -n FETCH_HEAD +fi + + +# spike - https://github.com/yaml/pyyaml/issues/266 +pip install -U "pyyaml!=5.1" +./run_system_test.py run 'system_test.prepare_tempest_env' -q --nologcapture --with-config "${CONFIG_NAME}" + +deactivate + diff --git a/maintenance-ci/mos/templates/tempest.multijob.yaml b/maintenance-ci/mos/templates/tempest.multijob.yaml new file mode 100644 index 0000000..774191a --- /dev/null +++ b/maintenance-ci/mos/templates/tempest.multijob.yaml @@ -0,0 +1,116 @@ +- job-template: + name: 9.x.tempest.{specification} + project-type: multijob + id: mos/templates/tempest_multijob + description: "9.2 tempest {description}" + build-discarder: + daysToKeep: 5 + numToKeep: 20 + artifactDaysToKeep: 5 + artifactNumToKeep: 20 + properties: + - heavy-job: + weight: 7 + parameters: + - node: + name: NODE_LABELS + default-slaves: + - mos-tempest + description: Select node where env been created and tempest been running + - string: + name: TESTRAIL_PLAN_NAME + default: '9.2 MU-X Tempest' + - string: + name: SNAPSHOT_PARAMS_ID + default: lastSuccessfulBuild + description: | + Take from https://maintenance-ci.scc.mirantis.net/job/9.x.snapshot.params/ + if you want use last build: lastSuccessfulBuild + Parameters that marked with '