]> review.fuel-infra Code Review - tools/sustaining.git/commitdiff
Initial tempest commit 22/41022/15
authorVladimir Khlyunev <vkhlyunev@mirantis.com>
Thu, 11 Apr 2019 10:42:59 +0000 (14:42 +0400)
committerVladimir Khlyunev <vkhlyunev@mirantis.com>
Mon, 3 Jun 2019 07:06:39 +0000 (11:06 +0400)
Change-Id: If499b677833b911eb266b81303307072bf2bcb71

maintenance-ci/mos/jobs/9.x.tempest.yaml [new file with mode: 0644]
maintenance-ci/mos/jobs/maintenance-tempest-report.yaml [new file with mode: 0644]
maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml [new file with mode: 0644]
maintenance-ci/mos/jobs/tempest.create_env.yaml [new file with mode: 0644]
maintenance-ci/mos/jobs/tempest.yaml [new file with mode: 0644]
maintenance-ci/mos/scripts/maintenance-tempest-report.sh [new file with mode: 0644]
maintenance-ci/mos/scripts/maintenance-tempest-runner.sh [new file with mode: 0644]
maintenance-ci/mos/scripts/tempest.create_env.sh [new file with mode: 0644]
maintenance-ci/mos/templates/tempest.multijob.yaml [new file with mode: 0644]
maintenance-ci/views/9.x.tempest.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 (file)
index 0000000..0540dec
--- /dev/null
@@ -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 (file)
index 0000000..1561e25
--- /dev/null
@@ -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: <a href="\1">TestRail Report URL</a>
+          description-for-failed: <a href="\1">TestRail Report URL</a>
diff --git a/maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml b/maintenance-ci/mos/jobs/maintenance-tempest-runner.yaml
new file mode 100644 (file)
index 0000000..238538d
--- /dev/null
@@ -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 (file)
index 0000000..b7c01bc
--- /dev/null
@@ -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 (file)
index 0000000..4da1b70
--- /dev/null
@@ -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 (file)
index 0000000..7297eb7
--- /dev/null
@@ -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 (file)
index 0000000..7f2be88
--- /dev/null
@@ -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 <<EOF
+iface=\$(grep -i -l "${public_mac}" /sys/class/net/*/address|awk -F'/' '{print \$5}')
+ifconfig "\${iface}" up
+ip addr add "${public_ip}.31/${public_net}" dev "\${iface}"
+EOF
+}
+
+wait_up_env() {
+    set +e
+    env_id=$(ssh_to_fuel_master "fuel env" | tail -1 | awk '{print $1}')
+    for testtype in ha sanity smoke; do
+        for iteration in {1..180}; do
+            failure=$(ssh_to_fuel_master "fuel health --env ${env_id} --check ${testtype}" | grep failure)
+            if [[ -z "${failure}" ]]; then
+                echo "${testtype} tests are passed"
+                break
+            else
+                echo "${testtype} tests failed on ${iteration} iteration: ${failure}"
+            fi
+            sleep 20
+        done
+    done
+    set -e
+}
+
+WORK_FLDR=$(ssh_to_fuel_master "mktemp -d")
+ssh_to_fuel_master "chmod 777 $WORK_FLDR"
+if [ "${MILESTONE_MAJOR}" -lt "9" ]; then
+   enable_public_ip
+fi
+ssh_to_fuel_master "fuel node | grep controller | awk '{print \$1}' | xargs -tI {} ssh node-{} sudo reboot"
+sleep 30
+ssh_to_fuel_master "fuel node | tail -n +3 | grep -v controller | awk '{print \$1}' | xargs -tI {} ssh node-{} sudo reboot"
+sleep 90
+wait_up_env
+
+echo "Used ${TEMPEST_RUNNER?} tempest runner"
+
+if [[ "${TEMPEST_RUNNER}" == "mos-tempest-runner" ]]; then
+    # for some reasons there is no "virtualenv" package in some deployment configuration
+    ssh_to_fuel_master "pip install virtualenv"
+    env_id=$(ssh_to_fuel_master "fuel env" | tail -1 | awk '{print $1}')
+    ssh_to_fuel_master "fuel --env ${env_id} settings --download"
+    objects_ceph=$(ssh_to_fuel_master "cat settings_${env_id}.yaml" | grep -A 7 "ceilometer:" | awk '/value:/{print $2}')
+    echo "Download and install mos-tempest-runner project"
+    git clone https://github.com/Mirantis/mos-tempest-runner.git -b "stable/${MILESTONE}"
+    rm -rf mos-tempest-runner/.git*
+    if ! ${objects_ceph}; then
+        sed -i '/test_list_no_containers/d' mos-tempest-runner/shouldfail/*/swift
+        sed -i '/test_list_no_containers/d' mos-tempest-runner/shouldfail/default_shouldfail.yaml
+    fi
+    scp_to_fuel_master -r mos-tempest-runner "${WORK_FLDR}"
+    ssh_to_fuel_master "/bin/bash -x $WORK_FLDR/mos-tempest-runner/setup_env.sh"
+    check_return_code_after_command_execution $? "Install mos-tempest-runner is failure."
+
+    echo "Run tempest tests"
+    set +e
+    ssh_to_fuel_master <<EOF | tee tempest_run.log
+/${WORK_FLDR}/mos-tempest-runner/rejoin.sh
+. /home/developer/mos-tempest-runner/.venv/bin/activate
+. /home/developer/openrc
+run_tests > ${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 (file)
index 0000000..5e2cac9
--- /dev/null
@@ -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 (file)
index 0000000..774191a
--- /dev/null
@@ -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 '<snapshot.params' not been used and can be ommited if this parameter provided
+    - string:
+        name: MAGNET_LINK_OVERWRITE
+        description: "Which ISO to use in tests"
+        default: !include-raw: ../data/9.0-iso
+    # section for mos rpm repos
+    - 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
+    - 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
+    - string:
+        name: VENV_PATH
+        default: "/home/jenkins/qa-venv-9.x"
+    - string:
+        name: FUEL_QA_GERRIT_REVIEW
+        description: "gerrit review num"
+        default: ""
+    builders:
+    - multijob:
+        name: Create Env
+        execution-type: SEQUENTIALLY
+        condition: COMPLETED
+        projects:
+        - name: 9.x.tempest.create_env
+          current-parameters: true
+          node-parameters: true
+          abort-all-job: true
+          predefined-parameters: |
+            ENV_NAME=9.x.tempest.{specification}
+            ERASE_ENV_PREFIX=^9.x.tempest.{specification}
+            DISABLE_SSL={ssl_disabled}
+            CONFIG_PATH={config_path}
+            SNAPSHOT_NAME={specification}
+            NOVA_QUOTAS=true
+        - name: maintenance-tempest-runner
+          current-parameters: true
+          node-parameters: true
+          abort-all-job: true
+          predefined-parameters: |
+            ENV_NAME=9.x.tempest.{specification}
+            SNAPSHOT_NAME={specification}
+            TEMPEST_RUNNER=rally_without_docker
+            MILESTONE=9.2
+            REPORT_PREFIX=$WORKSPACE/
+        - name: maintenance-tempest-report
+          current-parameters: true
+          node-parameters: true
+          abort-all-job: true
+          predefined-parameters: |
+            REPORT_FILE=$WORKSPACE/verification.xml
+            TEST_GROUP={test-group}
+            TESTRAIL_SUITE=[9.2][MOSQA] Tempest 9.2
+            MILESTONE=9.2
+            SPECIFICATION={specification}
+            USE_TEMPLATE=true
index d25227219986d29bbe5915e2ca8c26016cbf7f04..8eaf84fff0325eb817a258870c1b65a2a896935b 100644 (file)
@@ -1,7 +1,7 @@
 - view:
     type: list
     name: '9.x.tempest'
-    regex: '*tempest*'
+    regex: '.*tempest.*'
     jobs:
         - maintenance-tempest-report
         - maintenance-tempest-runner