Skip to content

Commit 5bfcda6

Browse files
authored
fix(aws-client-retry-test): correct retry delay assertion (#4274)
1 parent 2ebe2e5 commit 5bfcda6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

private/aws-client-retry-test/src/ClientRetryTest.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { GetInsightCommand, ThrottledException, XRayClient } from "@aws-sdk/client-xray";
22
import { HttpResponse } from "@aws-sdk/protocol-http";
33
import { RequestHandlerOutput } from "@aws-sdk/types";
4+
import { StandardRetryStrategy } from "@aws-sdk/util-retry";
45
import { Readable } from "stream";
56

67
describe("Middleware-retry integration tests", () => {
@@ -26,6 +27,7 @@ describe("Middleware-retry integration tests", () => {
2627
handle: () => Promise.resolve(mockSuccess),
2728
},
2829
});
30+
expect(await client.config.retryStrategy()).toBeInstanceOf(StandardRetryStrategy);
2931
const response = await client.send(getInsightCommand);
3032
expect(response.$metadata.httpStatusCode).toBe(200);
3133
expect(response.$metadata.attempts).toBe(1);
@@ -42,11 +44,12 @@ describe("Middleware-retry integration tests", () => {
4244
handle: mockHandle,
4345
},
4446
});
47+
expect(await client.config.retryStrategy()).toBeInstanceOf(StandardRetryStrategy);
4548
const response = await client.send(getInsightCommand);
4649
expect(response.$metadata.httpStatusCode).toBe(200);
4750
expect(mockHandle).toBeCalledTimes(3);
4851
expect(response.$metadata.attempts).toBe(3);
49-
expect(response.$metadata.totalRetryDelay).toBeGreaterThan(300);
52+
expect(response.$metadata.totalRetryDelay).toBeGreaterThan(0);
5053
});
5154
it("should retry until attemps are exhausted", async () => {
5255
const expectedException = new ThrottledException({
@@ -60,13 +63,14 @@ describe("Middleware-retry integration tests", () => {
6063
handle: () => Promise.resolve(mockThrottled),
6164
},
6265
});
66+
expect(await client.config.retryStrategy()).toBeInstanceOf(StandardRetryStrategy);
6367
try {
6468
await client.send(getInsightCommand);
6569
} catch (error) {
6670
expect(error).toStrictEqual(expectedException);
6771
expect(error.$metadata.httpStatusCode).toBe(429);
6872
expect(error.$metadata.attempts).toBe(4);
69-
expect(error.$metadata.totalRetryDelay).toBeGreaterThan(300);
73+
expect(error.$metadata.totalRetryDelay).toBeGreaterThan(0);
7074
}
7175
});
7276
});

0 commit comments

Comments
 (0)