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 |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame^] | 21 | echo "Running K6 performance tests..." |
| 22 | k6 --quiet run ncmp-kpi.js > summary.csv || ((number_of_failures++)) |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 23 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame^] | 24 | if [ -f summary.csv ]; then |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 25 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame^] | 26 | # Output raw CSV for plotting job |
| 27 | echo '-- BEGIN CSV REPORT' |
| 28 | cat summary.csv |
| 29 | echo '-- END CSV REPORT' |
| 30 | echo |
| 31 | |
| 32 | # Output human-readable report |
| 33 | echo '####################################################################################################' |
| 34 | echo '## K 6 P E R F O R M A N C E T E S T R E S U L T S ##' |
| 35 | echo '####################################################################################################' |
| 36 | column -t -s, summary.csv |
| 37 | echo |
| 38 | |
| 39 | # Clean up |
| 40 | rm -f summary.csv |
| 41 | |
| 42 | else |
| 43 | echo "Error: Failed to generate summary.csv" >&2 |
| 44 | ((number_of_failures++)) |
| 45 | fi |
| 46 | |
| 47 | popd >/dev/null || exit 1 |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 48 | |
| 49 | echo "NCMP TEST FAILURES: $number_of_failures" |
| 50 | exit $number_of_failures |