Skip to content

Commit a64134c

Browse files
tests: fix flaky timeout assertion in maintenance notification test (#3143)
* Add debug info to assertion messages for root cause analysis * Fix flaky timeout assertion in maintenance notification test * Apply same tolerance fix to NORMAL_COMMAND_TIMEOUT assertions
1 parent 7c419e0 commit a64134c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/client/lib/tests/test-scenario/timeout-during-notifications.e2e.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ describe("Timeout Handling During Notifications", () => {
125125
notifications.forEach((notification) => {
126126
assert.ok(
127127
result[notification]?.error instanceof Error,
128-
`${notification} notification error should be instanceof Error`
128+
`${notification} notification error should be instanceof Error. Got: ${JSON.stringify(result[notification])}`
129129
);
130130
assert.ok(
131-
result[notification]?.duration >= RELAXED_COMMAND_TIMEOUT &&
131+
result[notification]?.duration >= RELAXED_COMMAND_TIMEOUT * 0.8 &&
132132
result[notification]?.duration < RELAXED_COMMAND_TIMEOUT * 1.2,
133-
`${notification} notification should timeout within relaxed timeout`
133+
`${notification} notification should timeout within relaxed timeout. Duration: ${result[notification]?.duration}, Expected: [${RELAXED_COMMAND_TIMEOUT * 0.8}, ${RELAXED_COMMAND_TIMEOUT * 1.2})`
134134
);
135135
assert.strictEqual(
136136
result[notification]?.error?.constructor?.name,
137137
"CommandTimeoutDuringMaintenanceError",
138-
`${notification} notification error should be CommandTimeoutDuringMaintenanceError`
138+
`${notification} notification error should be CommandTimeoutDuringMaintenanceError. Got: ${result[notification]?.error?.constructor?.name}`
139139
);
140140
});
141141
});
@@ -164,9 +164,9 @@ describe("Timeout Handling During Notifications", () => {
164164
"Command Timeout error should be instanceof Error"
165165
);
166166
assert.ok(
167-
durationMigrate >= NORMAL_COMMAND_TIMEOUT &&
167+
durationMigrate >= NORMAL_COMMAND_TIMEOUT * 0.8 &&
168168
durationMigrate < NORMAL_COMMAND_TIMEOUT * 1.2,
169-
`Normal command should timeout within normal timeout ms`
169+
`Normal command should timeout within normal timeout ms. Duration: ${durationMigrate}, Expected: [${NORMAL_COMMAND_TIMEOUT * 0.8}, ${NORMAL_COMMAND_TIMEOUT * 1.2})`
170170
);
171171
assert.strictEqual(
172172
errorMigrate?.constructor?.name,
@@ -199,9 +199,9 @@ describe("Timeout Handling During Notifications", () => {
199199
"Command Timeout error should be instanceof Error"
200200
);
201201
assert.ok(
202-
durationBind >= NORMAL_COMMAND_TIMEOUT &&
202+
durationBind >= NORMAL_COMMAND_TIMEOUT * 0.8 &&
203203
durationBind < NORMAL_COMMAND_TIMEOUT * 1.2,
204-
`Normal command should timeout within normal timeout ms`
204+
`Normal command should timeout within normal timeout ms. Duration: ${durationBind}, Expected: [${NORMAL_COMMAND_TIMEOUT * 0.8}, ${NORMAL_COMMAND_TIMEOUT * 1.2})`
205205
);
206206
assert.strictEqual(
207207
errorBind?.constructor?.name,

0 commit comments

Comments
 (0)