Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 1 | #!/bin/bash |
pkazlenka | 4690e83 | 2024-10-24 13:28:37 +0200 | [diff] [blame] | 2 | |
| 3 | . "$(dirname "$0")/functions.sh" |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 4 | function kexec() { |
| 5 | kubectl exec -n qa-space --tty --stdin rally -- bash -c "${1}" |
| 6 | } |
| 7 | |
| 8 | # consts |
| 9 | concurrency=10 |
| 10 | run_times=200 |
| 11 | |
| 12 | tenv=mos |
| 13 | . /opt/si-tests/.sivenv/bin/activate |
| 14 | cd $MY_PROJFOLDER/tmp |
| 15 | . $MY_PROJFOLDER/env.sh |
| 16 | . $MY_PROJFOLDER/envs/${tenv}rc |
| 17 | # Just in case |
| 18 | unset TARGET_CLUSTER |
| 19 | unset TARGET_NAMESPACE |
| 20 | dryrun=0 |
| 21 | # |
| 22 | if [ ! -z ${1+x} ]; then |
| 23 | echo "# Using Dry-run mode" |
| 24 | dryrun=1 |
| 25 | fi |
| 26 | |
| 27 | ## |
| 28 | echo "### Checking rally environments" |
| 29 | status=$(kubectl -n qa-space get pod | grep rally | tr -s " " | cut -d' ' -f3) |
| 30 | if [ ${status} != "Running" ]; then |
| 31 | echo "# 'rally' container is not Running" |
| 32 | echo "# Consider creating resources and/or creating environments" |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | ### |
| 37 | uuid=$(kubectl exec -n qa-space --stdin rally -- rally env list | grep openstack | cut -d' ' -f2) |
| 38 | if [ -z ${uuid} ]; then |
| 39 | echo "# Openstack env not found. Please, run 'create-rally-deployments.sh'" |
| 40 | kubectl exec -n qa-space --stdin rally -- rally env list |
| 41 | else |
| 42 | echo "# Running Openstack performance tests" |
| 43 | if [ ${dryrun} == 1 ]; then |
| 44 | scenario=/rally/rally-files/openstack-mos-scn-i1.json |
| 45 | else |
| 46 | scenario=/rally/rally-files/openstack-mos-scn.json.clean |
| 47 | fi |
| 48 | task_scn=/artifacts/openstack-scenario.json |
| 49 | # prepare scenario |
| 50 | kexec "cp -v ${scenario} ${task_scn}" |
| 51 | declare $(kubectl exec toolset --stdin -n qa-space -- bash -c "cat /artifacts/cmp-check/cvp.manifest") |
| 52 | echo "# Updating network UUID to ${fixed_net_left_id}" |
| 53 | kexec "sed -i \"s/fixed-net-id/${fixed_net_left_id}/g\" ${task_scn}" |
| 54 | echo "# Updating concurrency to ${concurrency}" |
| 55 | kexec "sed -i \"s/concurrent-threads/${concurrency}/g\" ${task_scn}" |
| 56 | echo "# Updating running times to ${run_times}" |
| 57 | kexec "sed -i \"s/run-times-number/${run_times}/g\" ${task_scn}" |
| 58 | # run |
| 59 | kexec "rally env use ${uuid}; rally task start ${task_scn}" |
| 60 | # generate report |
| 61 | echo "# Generating report" |
pkazlenka | 4690e83 | 2024-10-24 13:28:37 +0200 | [diff] [blame] | 62 | fname="$MY_CLIENTSHORTNAME-mos-openstack-perf-$(get_timestamp).html" |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 63 | kubectl exec -n qa-space --stdin rally -- rally task report $(kubectl exec -n qa-space --stdin rally -- rally task list | grep openstack | cut -d' ' -f2 | tail -1) --html-static --out ${fname} |
| 64 | kubectl cp qa-space/rally:/rally/${fname} $MY_PROJFOLDER/reports/${fname} |
pkazlenka | 4690e83 | 2024-10-24 13:28:37 +0200 | [diff] [blame] | 65 | update_latest_report_to "$MY_PROJFOLDER/reports/${fname}" |
Alex | 2c8b880 | 2022-10-20 14:07:15 -0500 | [diff] [blame] | 66 | fi |