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