diff options
author | 2024-06-10 21:32:12 +0100 | |
---|---|---|
committer | 2024-06-14 16:17:13 +0100 | |
commit | f66694a076be41d83693423dec818493bcf66715 (patch) | |
tree | 452e1d54ea3a8a9c288c69491a5498118b5f57a0 /k6-tests/ncmp/1-create-cmhandles.js | |
parent | 35e0df312cbb2fd0a3740805636338713836b5e1 (diff) |
[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 <daniel.hanrahan@est.tech>
Change-Id: Ia9ebf61d21044b43063bde153f9c526e67d607c8
Diffstat (limited to 'k6-tests/ncmp/1-create-cmhandles.js')
-rw-r--r-- | k6-tests/ncmp/1-create-cmhandles.js | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/k6-tests/ncmp/1-create-cmhandles.js b/k6-tests/ncmp/1-create-cmhandles.js index 60594c7127..9a5c22ad3f 100644 --- a/k6-tests/ncmp/1-create-cmhandles.js +++ b/k6-tests/ncmp/1-create-cmhandles.js @@ -18,16 +18,9 @@ * ============LICENSE_END========================================================= */ -import http from 'k6/http'; import exec from 'k6/execution'; -import { check } from 'k6'; -import { - NCMP_BASE_URL, - DMI_PLUGIN_URL, - TOTAL_CM_HANDLES, - makeBatchOfCmHandleIds, - makeCustomSummaryReport -} from './utils.js'; +import { TOTAL_CM_HANDLES, makeBatchOfCmHandleIds, makeCustomSummaryReport } from './common/utils.js'; +import { createCmHandles } from './common/cmhandle-crud.js'; const BATCH_SIZE = 100; export const options = { @@ -40,25 +33,9 @@ export const options = { }; export default function () { - const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(BATCH_SIZE, exec.scenario.iterationInTest); - const payload = { - "dmiPlugin": DMI_PLUGIN_URL, - "createdCmHandles": nextBatchOfCmHandleIds.map(cmHandleId => ({ - "cmHandle": cmHandleId, - "cmHandleProperties": {"neType": "RadioNode"}, - "publicCmHandleProperties": { - "Color": "yellow", - "Size": "small", - "Shape": "cube" - } - })), - }; - const response = http.post(NCMP_BASE_URL + '/ncmpInventory/v1/ch', JSON.stringify(payload), { - headers: {'Content-Type': 'application/json'}, - }); - check(response, { - 'status equals 200': (r) => r.status === 200, - }); + const batchNumber = exec.scenario.iterationInTest; + const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(BATCH_SIZE, batchNumber); + createCmHandles(nextBatchOfCmHandleIds); } export function handleSummary(data) { |