diff options
Diffstat (limited to 'k6-tests/ncmp/common/utils.js')
-rw-r--r-- | k6-tests/ncmp/common/utils.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js index 6bedb1f949..57ab2ea17f 100644 --- a/k6-tests/ncmp/common/utils.js +++ b/k6-tests/ncmp/common/utils.js @@ -27,7 +27,7 @@ export const DMI_PLUGIN_URL = testConfig.hosts.dmiStubUrl; export const CONTAINER_UP_TIME_IN_SECONDS = testConfig.hosts.containerUpTimeInSeconds; export const LEGACY_BATCH_TOPIC_NAME = 'legacy_batch_topic'; export const TOTAL_CM_HANDLES = 50000; -export const REGISTRATION_BATCH_SIZE = 100; +export const REGISTRATION_BATCH_SIZE = 2000; export const READ_DATA_FOR_CM_HANDLE_DELAY_MS = 300; // must have same value as in docker-compose.yml export const WRITE_DATA_FOR_CM_HANDLE_DELAY_MS = 670; // must have same value as in docker-compose.yml export const CONTENT_TYPE_JSON_PARAM = {'Content-Type': 'application/json'}; @@ -48,6 +48,19 @@ export function makeBatchOfCmHandleIds(batchSize, batchNumber) { } /** + * Generates an unordered batch of CM-handle IDs based on batch size. + * @returns {string[]} Array of CM-handle IDs, for example ['ch-8', 'ch-2' ... 'ch-32432'] + */ +export function makeRandomBatchOfCmHandleIds() { + const cmHandleIds = new Set(); + while (cmHandleIds.size < LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE) { + const randomNum = Math.floor(Math.random() * TOTAL_CM_HANDLES) + 1; + cmHandleIds.add('ch-' + randomNum); + } + return Array.from(cmHandleIds) +} + +/** * Helper function to perform POST requests with JSON payload and content type. * @param {string} url - The URL to send the POST request to. * @param {Object} payload - The JSON payload to send in the POST request. |