From f66694a076be41d83693423dec818493bcf66715 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Mon, 10 Jun 2024 21:32:12 +0100 Subject: [k6] Refactoring k6 tests (#1) This commit moves all common request logic into a common folder. It is needed to avoid duplication before adding JVM warmup phase. - move registration-related code into common folder - move passthrough operations into common folder Issue-ID: CPS-2208 Signed-off-by: danielhanrahan Change-Id: Ia9ebf61d21044b43063bde153f9c526e67d607c8 --- k6-tests/ncmp/3-passthrough-read.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'k6-tests/ncmp/3-passthrough-read.js') diff --git a/k6-tests/ncmp/3-passthrough-read.js b/k6-tests/ncmp/3-passthrough-read.js index 84050b83ab..39eb4ad673 100644 --- a/k6-tests/ncmp/3-passthrough-read.js +++ b/k6-tests/ncmp/3-passthrough-read.js @@ -18,10 +18,9 @@ * ============LICENSE_END========================================================= */ -import http from 'k6/http'; -import { check } from 'k6'; -import { Trend } from "k6/metrics"; -import { NCMP_BASE_URL, getRandomCmHandleId, makeCustomSummaryReport } from './utils.js' +import { Trend } from 'k6/metrics'; +import { passthroughRead } from './common/passthrough-read.js' +import { makeCustomSummaryReport } from './common/utils.js' let ncmpOverheadTrend = new Trend("ncmp_overhead"); @@ -36,14 +35,7 @@ export const options = { // The function that defines VU logic. export default function () { - const cmHandleId = getRandomCmHandleId(); - const datastoreName = 'ncmp-datastore%3Apassthrough-operational'; - const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleId}/data/ds/${datastoreName}?resourceIdentifier=x&include-descendants=true` - const response = http.get(url); - check(response, { - 'status equals 200': (r) => r.status === 200, - }); - + const response = passthroughRead(); // Calculate overhead assuming DMI data delay is 2500ms. const dmiDelay = 2500; // This should be same as value DATA_FOR_CM_HANDLE_DELAY_MS in docker-compose.yml const overhead = response.timings.duration - dmiDelay; -- cgit 1.2.3-korg