2025-07-19 14:24:30 +10:00
|
|
|
import {
|
2025-07-29 10:17:43 +03:00
|
|
|
generateRandomString,
|
|
|
|
|
printSizeDistributionReport,
|
|
|
|
|
runTest,
|
|
|
|
|
setupTest
|
|
|
|
|
} from "./sharedTestUtils.js";
|
2025-07-14 11:38:42 +03:00
|
|
|
|
2025-07-29 10:17:43 +03:00
|
|
|
const sizes = [10, 100, 1000, 10_000, 100_000]; // bytes
|
2025-07-14 11:38:42 +03:00
|
|
|
|
|
|
|
|
describe("Throughput Sanity Checks - Different Message Sizes", function () {
|
|
|
|
|
const testDurationMs = 20 * 60 * 1000; // 20 minute
|
2025-07-29 10:17:43 +03:00
|
|
|
const testContext: { report?: any } = {};
|
2025-07-14 11:38:42 +03:00
|
|
|
|
2025-07-29 10:17:43 +03:00
|
|
|
setupTest(this, testContext);
|
2025-07-14 11:38:42 +03:00
|
|
|
|
2025-07-29 10:17:43 +03:00
|
|
|
afterEach(async () => {
|
|
|
|
|
if (testContext.report) {
|
|
|
|
|
printSizeDistributionReport(testContext.report);
|
|
|
|
|
}
|
2025-07-14 11:38:42 +03:00
|
|
|
});
|
|
|
|
|
|
2025-07-29 10:17:43 +03:00
|
|
|
runTest({
|
|
|
|
|
testContext: testContext,
|
|
|
|
|
testDurationMs: testDurationMs,
|
|
|
|
|
testName: "Throughput Sanity Checks - Different Message Sizes",
|
|
|
|
|
messageGenerator: (_messageId: number) => {
|
2025-07-14 11:38:42 +03:00
|
|
|
const size = sizes[Math.floor(Math.random() * sizes.length)];
|
2025-07-29 10:17:43 +03:00
|
|
|
return generateRandomString(size);
|
|
|
|
|
},
|
|
|
|
|
delayBetweenMessagesMs: 400
|
2025-07-14 11:38:42 +03:00
|
|
|
});
|
|
|
|
|
});
|