diff options
author | halil.cakal <halil.cakal@est.tech> | 2024-07-11 14:54:57 +0100 |
---|---|---|
committer | halil.cakal <halil.cakal@est.tech> | 2024-07-12 14:09:27 +0100 |
commit | fcc81ee3a4b9ae937e0f447ee574b676506b6390 (patch) | |
tree | 0c81ec5a24766c6e49a75dff4a11bf1e6abca0a0 /k6-tests | |
parent | 1519ce5850a4a1f127d18ebf8b37e4a96d365a28 (diff) |
Add passthrough write (CUD) operations to k6
- the delay for dmi has been hanlded in seprate commit
- for simplicity only the POST request is considered
Issue-ID: CPS-2267
Change-Id: I62ede04dd8e2744fc723566742396df31c42ea5d
Signed-off-by: halil.cakal <halil.cakal@est.tech>
Diffstat (limited to 'k6-tests')
-rw-r--r-- | k6-tests/ncmp/common/passthrough-crud.js (renamed from k6-tests/ncmp/common/passthrough-read.js) | 12 | ||||
-rw-r--r-- | k6-tests/ncmp/common/utils.js | 1 | ||||
-rw-r--r-- | k6-tests/ncmp/ncmp-kpi.js | 14 | ||||
-rwxr-xr-x | k6-tests/setup.sh | 2 |
4 files changed, 26 insertions, 3 deletions
diff --git a/k6-tests/ncmp/common/passthrough-read.js b/k6-tests/ncmp/common/passthrough-crud.js index 89ed15af79..43a215fdf8 100644 --- a/k6-tests/ncmp/common/passthrough-read.js +++ b/k6-tests/ncmp/common/passthrough-crud.js @@ -19,7 +19,7 @@ */ import http from 'k6/http'; -import { NCMP_BASE_URL, getRandomCmHandleId } from './utils.js'; +import { NCMP_BASE_URL, CONTENT_TYPE_JSON_PARAM, getRandomCmHandleId } from './utils.js'; export function passthroughRead() { const cmHandleId = getRandomCmHandleId(); @@ -30,3 +30,13 @@ export function passthroughRead() { const response = http.get(url); return response; } + +export function passthroughWrite() { + const cmHandleId = getRandomCmHandleId(); + const resourceIdentifier = 'my-resource-identifier'; + const datastoreName = 'ncmp-datastore:passthrough-running'; + const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleId}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}` + const body = `{"neType": "BaseStation"}` + const response = http.post(url, JSON.stringify(body), CONTENT_TYPE_JSON_PARAM); + return response; +} diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js index 54b4c3a099..75c4ec763e 100644 --- a/k6-tests/ncmp/common/utils.js +++ b/k6-tests/ncmp/common/utils.js @@ -59,6 +59,7 @@ export function makeCustomSummaryReport(data, options) { summaryCsv += makeSummaryCsvLine(3, 'CM-handle ID search with Module filter', 'milliseconds', 'http_req_duration{scenario:id_search_module}', data, options); summaryCsv += makeSummaryCsvLine(4, 'CM-handle search with Module filter', 'milliseconds', 'http_req_duration{scenario:cm_search_module}', data, options); summaryCsv += makeSummaryCsvLine(5, 'Synchronous single CM-handle pass-through read', 'milliseconds', 'http_req_duration{scenario:passthrough_read}', data, options); + summaryCsv += makeSummaryCsvLine(6, 'Synchronous single CM-handle pass-through write', 'requests/second', 'http_reqs{scenario:passthrough_write}', data, options); return summaryCsv; } diff --git a/k6-tests/ncmp/ncmp-kpi.js b/k6-tests/ncmp/ncmp-kpi.js index 91a38d99ce..24fbef0bfc 100644 --- a/k6-tests/ncmp/ncmp-kpi.js +++ b/k6-tests/ncmp/ncmp-kpi.js @@ -23,7 +23,7 @@ import { Gauge } from 'k6/metrics'; import { TOTAL_CM_HANDLES, makeCustomSummaryReport, recordTimeInSeconds } from './common/utils.js'; import { registerAllCmHandles, deregisterAllCmHandles } from './common/cmhandle-crud.js'; import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js'; -import { passthroughRead } from './common/passthrough-read.js'; +import { passthroughRead, passthroughWrite } from './common/passthrough-crud.js'; let cmHandlesCreatedPerSecondGauge = new Gauge('cmhandles_created_per_second'); let cmHandlesDeletedPerSecondGauge = new Gauge('cmhandles_deleted_per_second'); @@ -40,6 +40,12 @@ export const options = { vus: 10, duration: DURATION, }, + passthrough_write: { + executor: 'constant-vus', + exec: 'passthrough_write', + vus: 10, + duration: DURATION, + }, id_search_module: { executor: 'constant-vus', exec: 'id_search_module', @@ -57,6 +63,7 @@ export const options = { 'cmhandles_created_per_second': ['value >= 22'], 'cmhandles_deleted_per_second': ['value >= 22'], 'http_req_failed{scenario:passthrough_read}': ['rate == 0'], + 'http_reqs{scenario:passthrough_write}': ['rate >= 13'], 'http_req_failed{scenario:id_search_module}': ['rate == 0'], 'http_req_failed{scenario:cm_search_module}': ['rate == 0'], 'http_req_duration{scenario:passthrough_read}': ['avg <= 2600'], // DMI delay + 100 ms @@ -80,6 +87,11 @@ export function passthrough_read() { check(response, { 'passthrough read status equals 200': (r) => r.status === 200 }); } +export function passthrough_write() { + const response = passthroughWrite(); + check(response, { 'passthrough write status equals 200': (r) => r.status === 200 }); +} + export function id_search_module() { const response = executeCmHandleIdSearch('module'); check(response, { 'module ID search status equals 200': (r) => r.status === 200 }); diff --git a/k6-tests/setup.sh b/k6-tests/setup.sh index 86f6d26acd..346b9c0690 100755 --- a/k6-tests/setup.sh +++ b/k6-tests/setup.sh @@ -26,5 +26,5 @@ CONTAINER_IDS=$(docker ps --filter "name=cps-and-ncmp" --format "{{.ID}}") # Check the logs for each container for CONTAINER_ID in $CONTAINER_IDS; do echo "Checking logs for container: $CONTAINER_ID" - docker logs "$CONTAINER_ID" -f | grep -m 1 "$READY_MESSAGE" >/dev/null || true + docker logs "$CONTAINER_ID" -f | grep -m 1 "$READY_MESSAGE" >/dev/null && echo "CPS is ready in container: $CONTAINER_ID" || true done |