Merge "Add passthrough write (CUD) operations to k6"
diff --git a/k6-tests/ncmp/common/passthrough-read.js b/k6-tests/ncmp/common/passthrough-crud.js
similarity index 71%
rename from k6-tests/ncmp/common/passthrough-read.js
rename to k6-tests/ncmp/common/passthrough-crud.js
index 89ed15a..43a215f 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 @@
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 54b4c3a..75c4ec7 100644
--- a/k6-tests/ncmp/common/utils.js
+++ b/k6-tests/ncmp/common/utils.js
@@ -59,6 +59,7 @@
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 91a38d9..24fbef0 100644
--- a/k6-tests/ncmp/ncmp-kpi.js
+++ b/k6-tests/ncmp/ncmp-kpi.js
@@ -23,7 +23,7 @@
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 @@
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 @@
'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 @@
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 86f6d26..346b9c0 100755
--- a/k6-tests/setup.sh
+++ b/k6-tests/setup.sh
@@ -26,5 +26,5 @@
# 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