Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
pkazlenka | 4690e83 | 2024-10-24 13:28:37 +0200 | [diff] [blame] | 2 | |
| 3 | . "$(dirname "$0")/functions.sh" |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 4 | tenv=mos |
| 5 | . /opt/si-tests/.sivenv/bin/activate |
| 6 | cd $MY_PROJFOLDER/tmp |
| 7 | . $MY_PROJFOLDER/env.sh |
| 8 | . $MY_PROJFOLDER/envs/${tenv}rc |
Ievgeniia Zadorozhna | 826e6f8 | 2024-03-05 19:53:53 +0100 | [diff] [blame] | 9 | |
| 10 | if grep -q "public_subnet_uuid" "$MY_PROJFOLDER/yamls/tempest_custom.yaml"; then |
| 11 | echo "The ${MY_PROJFOLDER}/yamls/tempest_custom.yaml file is not updated, it has the placeholders. Please run '. $MY_PROJFOLDER/env.sh && . $MY_PROJFOLDER/envs/mosrc && bash $MY_PROJFOLDER/scripts/update-openstack-resources.sh' before running tempest." |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 15 | # Just in case |
| 16 | unset TARGET_CLUSTER |
| 17 | unset TARGET_NAMESPACE |
Alex | 876e93a | 2022-12-21 12:02:13 -0600 | [diff] [blame] | 18 | # Cleaning up |
| 19 | echo "# Cleaning up '/artifacts/tmp/artifacts/'" |
| 20 | [ -d "/artifacts/tmp/artifacts/" ] && rm -rf "/artifacts/tmp/artifacts/" |
| 21 | [ -f "/artifacts/tmp/nosetests.xml" ] && rm "/artifacts/tmp/nosetests.xml" |
| 22 | mkdir "/artifacts/tmp/artifacts/" |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 23 | |
| 24 | # |
| 25 | echo "# Creating schema" |
| 26 | [ -f "/artifacts/tmp/artifacts/test_scheme.yaml" ] && rm -v $MY_PROJFOLDER/tmp/artifacts/test_scheme.yaml |
| 27 | cat <<'EOF' >artifacts/test_scheme.yaml |
| 28 | --- |
| 29 | smoke: true |
| 30 | concurrency: 4 |
| 31 | blacklist-file: /etc/tempest/test-blacklist |
| 32 | enabled: true |
| 33 | fail_on_test: true |
| 34 | type: tempest |
| 35 | # regex: test |
| 36 | EOF |
| 37 | cat artifacts/test_scheme.yaml |
| 38 | echo " " |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 39 | env | grep TEMPEST_ |
| 40 | echo " " |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 41 | # |
| 42 | echo "# Checking auto-allocation" |
| 43 | cmd="openstack network auto allocated topology create --check-resources" |
| 44 | kubectl -n qa-space exec toolset --stdin -- $cmd |
| 45 | if [ $? -ne 0 ]; then |
| 46 | cmd="openstack network set --default --external ${TEMPEST_CUSTOM_PUBLIC_NET}" |
| 47 | echo "# Trying to set network: '${cmd}'" |
| 48 | kubectl -n qa-space exec toolset --stdin -- $cmd |
| 49 | echo "# Checking again" |
| 50 | cmd="openstack network auto allocated topology create --check-resources" |
| 51 | kubectl -n qa-space exec toolset --stdin -- $cmd |
| 52 | [ $? -ne 0 ] && printf "\n\n# WARNING: Check functional tests pod for errors on test init\n\n" |
| 53 | fi |
| 54 | |
| 55 | # run tests |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 56 | pytest -vv /opt/si-tests/si_tests/tests/lcm/test_run_tempest.py |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 57 | deactivate |
| 58 | |
| 59 | # report |
| 60 | if [ -d $MY_PROJFOLDER/reports/${tenv}-func ]; then |
| 61 | echo "# Generating repors" |
| 62 | yes | rm $MY_PROJFOLDER/reports/${tenv}-func/* |
| 63 | else |
| 64 | mkdir $MY_PROJFOLDER/reports/${tenv}-func |
| 65 | fi |
| 66 | cp ./artifacts/*.xml $MY_PROJFOLDER/reports/${tenv}-func/ |
| 67 | cd $MY_PROJFOLDER/reports/ |
pkazlenka | 4690e83 | 2024-10-24 13:28:37 +0200 | [diff] [blame] | 68 | fname="$MY_CLIENTSHORTNAME-${tenv}-openstack-func-smoke-$(get_timestamp).html" |
| 69 | tparser -f r_xml -d -r "${fname}" $MY_PROJFOLDER/reports/${tenv}-func/ |
| 70 | update_latest_report_to "${fname}" |
Alex | a0053b9 | 2022-10-14 16:38:28 -0500 | [diff] [blame] | 71 | cd $MY_PROJFOLDER |