From: egernug Date: Fri, 6 Sep 2024 11:09:31 +0000 (+0100) Subject: [k6] Fix incorrect results when errors occur in k6 tests (case 2) X-Git-Tag: 3.5.3~27 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=2bdef267963c83509590b5c895f93380545720aa;p=cps.git [k6] Fix incorrect results when errors occur in k6 tests (case 2) De-registration is reported as 200,000 handles per second if all operations fail - Added a running total for successful de-registrations of CM Handles Issue-ID: CPS-2346 Change-Id: Ib4302d3b605ff1eaf4ecadac11b4e851a69210df Signed-off-by: egernug --- diff --git a/k6-tests/ncmp/ncmp-kpi.js b/k6-tests/ncmp/ncmp-kpi.js index ef3d0c60de..1d084f21e3 100644 --- a/k6-tests/ncmp/ncmp-kpi.js +++ b/k6-tests/ncmp/ncmp-kpi.js @@ -139,17 +139,21 @@ export function setup() { export function teardown() { const startTimeInMillis = Date.now(); + let DEREGISTERED_CM_HANDLES = 0 const TOTAL_BATCHES = Math.ceil(TOTAL_CM_HANDLES / REGISTRATION_BATCH_SIZE); for (let batchNumber = 0; batchNumber < TOTAL_BATCHES; batchNumber++) { const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(REGISTRATION_BATCH_SIZE, batchNumber); const response = deleteCmHandles(nextBatchOfCmHandleIds); + if (response.error_code === 0) { + DEREGISTERED_CM_HANDLES += REGISTRATION_BATCH_SIZE + } check(response, { 'delete CM-handles status equals 200': (r) => r.status === 200 }); } const endTimeInMillis = Date.now(); const totalDeregistrationTimeInSeconds = (endTimeInMillis - startTimeInMillis) / 1000.0; - cmHandlesDeletedPerSecondTrend.add(TOTAL_CM_HANDLES / totalDeregistrationTimeInSeconds); + cmHandlesDeletedPerSecondTrend.add(DEREGISTERED_CM_HANDLES / totalDeregistrationTimeInSeconds); } export function executePassthroughReadScenario() {