Skip to content

Commit 84f0d1d

Browse files
committed
fix: python assertion
1 parent c47cbe7 commit 84f0d1d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scripts/cts/testServer/error.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type express from 'express';
55

66
import { setupServer } from './index.ts';
77

8-
const errorState: Record<string, { errorCount: number }> = {};
8+
const errorState: Record<string, { errorCount: number; maxError: number }> = {};
99

1010
export function assertValidErrors(expectedCount: number): void {
1111
// assert that the retry strategy uses the correct timings, by checking the time between each request, and how long each request took before being timed out
@@ -15,14 +15,14 @@ export function assertValidErrors(expectedCount: number): void {
1515
}
1616

1717
for (const [lang, state] of Object.entries(errorState)) {
18-
let numberOfTestSuites = 1;
19-
2018
// python has sync and async tests
2119
if (lang === 'python') {
22-
numberOfTestSuites = 2;
20+
expect(state.errorCount).to.equal(state.maxError * 2);
21+
22+
return;
2323
}
2424

25-
expect(state.errorCount).to.equal(Number(numberOfTestSuites) * 3);
25+
expect(state.errorCount).to.equal(state.maxError);
2626
}
2727
}
2828

@@ -32,12 +32,13 @@ function addRoutes(app: express.Express): void {
3232
if (!errorState[lang]) {
3333
errorState[lang] = {
3434
errorCount: 0,
35+
maxError: 3,
3536
};
3637
}
3738

3839
errorState[lang].errorCount++;
3940

40-
if (errorState[lang].errorCount < 3) {
41+
if (errorState[lang].errorCount % errorState[lang].maxError !== 0) {
4142
res.status(500).json({ message: 'error test server response' });
4243
return;
4344
}

0 commit comments

Comments
 (0)