Refactor tests

This commit is contained in:
Andras Schmelczer 2026-01-18 13:46:59 +00:00
commit f53ac121e8

View file

@ -6,7 +6,7 @@ import { v4 as uuidv4 } from "uuid";
import { randomCasing } from "./utils/random-casing";
const TEST_ITERATIONS = 5;
const MAX_INITIAL_DOCS = 5;
const MAX_INITIAL_DOCS = 0;
// Simulate async file access by injecting waiting time before returning from file operations.
let slowFileEvents = false;
@ -65,8 +65,6 @@ async function runTest({
}
try {
await utils.awaitAll(clients.map(async (client) => client.init()));
for (const client of clients) {
const initialDocCount = Math.floor(
Math.random() * MAX_INITIAL_DOCS
@ -79,6 +77,10 @@ async function runTest({
}
}
await utils.awaitAll(clients.map(async (client) => client.init()));
for (let i = 0; i < iterations; i++) {
logger.info(`Iteration ${i + 1}/${iterations}`);
await utils.awaitAll(clients.map(async (client) => client.act()));
@ -217,5 +219,8 @@ runTests()
})
.catch((error: unknown) => {
logger.error(`Error - tests failed with ${error}`);
if (error instanceof Error && error.stack) {
logger.error(error.stack);
}
process.exit(1);
});