danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2024 Nordix Foundation. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 18 | pushd "$(dirname "$0")" >/dev/null || exit 1 |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 19 | |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 20 | number_of_failures=0 |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 21 | testProfile=$1 |
| 22 | summaryFile="${testProfile}Summary.csv" |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 23 | echo "Running $testProfile performance tests..." |
halil.cakal | fd5b04c | 2024-11-19 11:10:32 +0000 | [diff] [blame] | 24 | |
| 25 | k6 run ncmp-test-runner.js --quiet -e TEST_PROFILE="$testProfile" > "$summaryFile" 2>/dev/null || ((number_of_failures++)) |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 26 | |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 27 | if [ -f "$summaryFile" ]; then |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 28 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 29 | # Output raw CSV for plotting job |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 30 | echo "-- BEGIN CSV REPORT" |
| 31 | cat "$summaryFile" |
| 32 | echo "-- END CSV REPORT" |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 33 | echo |
| 34 | |
| 35 | # Output human-readable report |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 36 | echo "####################################################################################################" |
| 37 | if [ "$testProfile" = "kpi" ]; then |
| 38 | echo "## K 6 K P I P E R F O R M A N C E T E S T R E S U L T S ##" |
| 39 | else |
| 40 | echo "## K 6 E N D U R A N C E P E R F O R M A N C E T E S T R E S U L T S ##" |
| 41 | fi |
| 42 | echo "####################################################################################################" |
| 43 | column -t -s, "$summaryFile" |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 44 | echo |
| 45 | |
| 46 | # Clean up |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 47 | rm -f "$summaryFile" |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 48 | |
| 49 | else |
halil.cakal | b685df0 | 2024-11-06 15:05:22 +0000 | [diff] [blame] | 50 | echo "Error: Failed to generate $summaryFile" >&2 |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 51 | ((number_of_failures++)) |
| 52 | fi |
| 53 | |
| 54 | popd >/dev/null || exit 1 |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 55 | |
| 56 | echo "NCMP TEST FAILURES: $number_of_failures" |
| 57 | exit $number_of_failures |