diff options
author | halil.cakal <halil.cakal@est.tech> | 2024-11-06 15:05:22 +0000 |
---|---|---|
committer | halil.cakal <halil.cakal@est.tech> | 2024-11-18 12:24:04 +0000 |
commit | b685df03750be0ee1b9c55632dceedb7dbf4961a (patch) | |
tree | 1e2daa9df4c0ea4503e1b29230d4a960144b58e4 /k6-tests/ncmp | |
parent | 37962e3faca4f2306546c4f70d480b0c323d2c68 (diff) |
Add new k6 test profile for running edurance tests
- assign a profile name to the existing k6 tests (kpi)
- add control which profile is run using k6 config file
- both test profiles can run in parallel
Issue-ID: CPS-2464
Change-Id: I9fea13f12e2da46bd55b4315c68209843c1abe06
Signed-off-by: halil.cakal <halil.cakal@est.tech>
Diffstat (limited to 'k6-tests/ncmp')
-rw-r--r-- | k6-tests/ncmp/common/utils.js | 12 | ||||
-rw-r--r-- | k6-tests/ncmp/config/endurance.json | 13 | ||||
-rw-r--r-- | k6-tests/ncmp/config/kpi.json | 14 | ||||
-rw-r--r-- | k6-tests/ncmp/ncmp-kpi.js | 11 | ||||
-rwxr-xr-x | k6-tests/ncmp/run-all-tests.sh | 31 |
5 files changed, 57 insertions, 24 deletions
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js index a2467edf6f..45f6e96050 100644 --- a/k6-tests/ncmp/common/utils.js +++ b/k6-tests/ncmp/common/utils.js @@ -19,8 +19,14 @@ */ import http from 'k6/http'; -export const NCMP_BASE_URL = 'http://localhost:8883'; -export const DMI_PLUGIN_URL = 'http://ncmp-dmi-plugin-demo-and-csit-stub:8092'; + +const testConfig = JSON.parse(open(`../config/${__ENV.TEST_PROFILE}.json`)); +export const KAFKA_BOOTSTRAP_SERVERS = testConfig.hosts.kafkaBootstrapServer; +export const LEGACY_BATCH_TOPIC_NAME = testConfig.kafka.legacyBatchTopic; +export const DURATION = testConfig.timingConfig.testDuration; +export const LEGACY_BATCH_THROUGHPUT_TEST_START_TIME = testConfig.timingConfig.legacyBatchThroughputTestStartTime; +export const NCMP_BASE_URL = testConfig.hosts.ncmpBaseUrl; +export const DMI_PLUGIN_URL = testConfig.hosts.dmiStubUrl; export const TOTAL_CM_HANDLES = 20000; export const REGISTRATION_BATCH_SIZE = 100; export const READ_DATA_FOR_CM_HANDLE_DELAY_MS = 300; // must have same value as in docker-compose.yml @@ -28,8 +34,6 @@ export const WRITE_DATA_FOR_CM_HANDLE_DELAY_MS = 670; // must have same value as export const CONTENT_TYPE_JSON_PARAM = {'Content-Type': 'application/json'}; export const LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE = 200; export const LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS = 100; -export const LEGACY_BATCH_TOPIC_NAME = 'legacy_batch_topic'; -export const KAFKA_BOOTSTRAP_SERVERS = ['localhost:9092']; export const MODULE_SET_TAGS = ['tagA', 'tagB', 'tagC', 'tagD', 'tagE']; diff --git a/k6-tests/ncmp/config/endurance.json b/k6-tests/ncmp/config/endurance.json new file mode 100644 index 0000000000..c9def6ce39 --- /dev/null +++ b/k6-tests/ncmp/config/endurance.json @@ -0,0 +1,13 @@ +{ + "hosts": { + "ncmpBaseUrl": "http://localhost:8884", + "dmiStubUrl": "http://ncmp-dmi-plugin-demo-and-csit-stub:8092", + "kafkaBootstrapServer": "localhost:9093" + }, + "timingConfig": { + "testDuration": "2h" + }, + "kafka": { + "legacyBatchTopic": "legacy_batch_topic" + } +} diff --git a/k6-tests/ncmp/config/kpi.json b/k6-tests/ncmp/config/kpi.json new file mode 100644 index 0000000000..ad79f92d4d --- /dev/null +++ b/k6-tests/ncmp/config/kpi.json @@ -0,0 +1,14 @@ +{ + "hosts": { + "ncmpBaseUrl": "http://localhost:8883", + "dmiStubUrl": "http://ncmp-dmi-plugin-demo-and-csit-stub:8092", + "kafkaBootstrapServer": "localhost:9092" + }, + "timingConfig": { + "testDuration": "15m", + "legacyBatchThroughputTestStartTime": "15m30s" + }, + "kafka": { + "legacyBatchTopic": "legacy_batch_topic" + } +}
\ No newline at end of file diff --git a/k6-tests/ncmp/ncmp-kpi.js b/k6-tests/ncmp/ncmp-kpi.js index e46c547c30..20fb1e86a9 100644 --- a/k6-tests/ncmp/ncmp-kpi.js +++ b/k6-tests/ncmp/ncmp-kpi.js @@ -24,8 +24,8 @@ import { Reader } from 'k6/x/kafka'; import { TOTAL_CM_HANDLES, READ_DATA_FOR_CM_HANDLE_DELAY_MS, WRITE_DATA_FOR_CM_HANDLE_DELAY_MS, makeCustomSummaryReport, makeBatchOfCmHandleIds, LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE, - LEGACY_BATCH_TOPIC_NAME, KAFKA_BOOTSTRAP_SERVERS, REGISTRATION_BATCH_SIZE, - LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS + REGISTRATION_BATCH_SIZE, LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS, DURATION, + LEGACY_BATCH_THROUGHPUT_TEST_START_TIME, KAFKA_BOOTSTRAP_SERVERS, LEGACY_BATCH_TOPIC_NAME } from './common/utils.js'; import { createCmHandles, deleteCmHandles, waitForAllCmHandlesToBeReady } from './common/cmhandle-crud.js'; import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js'; @@ -49,14 +49,11 @@ let cmSearchCpsPathDurationTrend = new Trend('cm_search_cpspath_duration', true) let cmSearchTrustLevelDurationTrend = new Trend('cm_search_trustlevel_duration', true); let legacyBatchReadCmHandlesPerSecondTrend = new Trend('legacy_batch_read_cmhandles_per_second', false); -const legacyBatchEventReader = new Reader({ - brokers: KAFKA_BOOTSTRAP_SERVERS, +export const legacyBatchEventReader = new Reader({ + brokers: [KAFKA_BOOTSTRAP_SERVERS], topic: LEGACY_BATCH_TOPIC_NAME, }); -const DURATION = '15m'; -const LEGACY_BATCH_THROUGHPUT_TEST_START_TIME = '15m30s'; - export const options = { setupTimeout: '20m', teardownTimeout: '20m', diff --git a/k6-tests/ncmp/run-all-tests.sh b/k6-tests/ncmp/run-all-tests.sh index 1fa661a472..3457903c01 100755 --- a/k6-tests/ncmp/run-all-tests.sh +++ b/k6-tests/ncmp/run-all-tests.sh @@ -18,31 +18,36 @@ pushd "$(dirname "$0")" >/dev/null || exit 1 number_of_failures=0 -echo "Running K6 performance tests..." +testProfile=$1 +summaryFile="${testProfile}Summary.csv" -# Redirecting stderr to /dev/null to prevent large log files -k6 --quiet run ncmp-kpi.js > summary.csv 2>/dev/null || ((number_of_failures++)) +echo "Running $testProfile performance tests..." +k6 run ncmp-kpi.js --quiet -e TEST_PROFILE="$testProfile" > "$summaryFile" 2>/dev/null || ((number_of_failures++)) -if [ -f summary.csv ]; then +if [ -f "$summaryFile" ]; then # Output raw CSV for plotting job - echo '-- BEGIN CSV REPORT' - cat summary.csv - echo '-- END CSV REPORT' + echo "-- BEGIN CSV REPORT" + cat "$summaryFile" + echo "-- END CSV REPORT" echo # Output human-readable report - echo '####################################################################################################' - 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 ##' - echo '####################################################################################################' - column -t -s, summary.csv + echo "####################################################################################################" + if [ "$testProfile" = "kpi" ]; then + 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 ##" + else + 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 ##" + fi + echo "####################################################################################################" + column -t -s, "$summaryFile" echo # Clean up - rm -f summary.csv + rm -f "$summaryFile" else - echo "Error: Failed to generate summary.csv" >&2 + echo "Error: Failed to generate $summaryFile" >&2 ((number_of_failures++)) fi |