Skip to content

Commit 2e6b8c0

Browse files
committed
test(client-kinesis): resolve e2e endpoint from client config
1 parent 91d738d commit 2e6b8c0

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

clients/client-kinesis/test/Kinesis.e2e.spec.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ describe("@aws-sdk/client-kinesis", () => {
2222
return (client.config.requestHandler as any).connectionManager?.debug?.();
2323
};
2424

25+
/**
26+
* The endpoint the client resolves to, used as the connection pool key.
27+
* Resolved from the client config instead of being hardcoded, so the test
28+
* follows the client's configured region/endpoint.
29+
*/
30+
let endpoint: string;
31+
2532
async function setup() {
2633
await client.createStream({ StreamName: STREAM_NAME, ShardCount: SHARD_COUNT });
2734
let status = "";
@@ -113,10 +120,17 @@ describe("@aws-sdk/client-kinesis", () => {
113120
* ```
114121
*/
115122
function getSessions(state: any) {
116-
return state?.["https://kinesis.us-west-2.amazonaws.com/"]?.sessions ?? [];
123+
return state?.[endpoint]?.sessions ?? [];
117124
}
118125

119126
beforeAll(async () => {
127+
const { url } = client.config.endpointProvider({
128+
Region: await client.config.region(),
129+
UseFIPS: await client.config.useFipsEndpoint(),
130+
UseDualStack: await client.config.useDualstackEndpoint(),
131+
});
132+
endpoint = url.toString();
133+
120134
connectionManagerStates.initial = debug();
121135
await setup();
122136

@@ -161,7 +175,6 @@ describe("@aws-sdk/client-kinesis", () => {
161175
});
162176

163177
describe("Node.js HTTP2 session concurrency", () => {
164-
const usWest2Endpoint = "https://kinesis.us-west-2.amazonaws.com/";
165178
const sessionType = {
166179
id: expect.any(Number),
167180
active: expect.any(Number),
@@ -179,20 +192,20 @@ describe("@aws-sdk/client-kinesis", () => {
179192

180193
expect(getSessions(connectionManagerStates.requestsFinished)).not.toEqual([]);
181194
expect(connectionManagerStates.requestsFinished).toMatchObject({
182-
[usWest2Endpoint]: {
195+
[endpoint]: {
183196
sessions: getSessions(connectionManagerStates.requestsFinished).map(() => sessionType),
184197
},
185198
});
186199

187200
expect(getSessions(connectionManagerStates.secondBatchRequestsFinished)).not.toEqual([]);
188201
expect(connectionManagerStates.secondBatchRequestsFinished).toMatchObject({
189-
[usWest2Endpoint]: {
202+
[endpoint]: {
190203
sessions: getSessions(connectionManagerStates.secondBatchRequestsFinished).map(() => sessionType),
191204
},
192205
});
193206

194207
expect(connectionManagerStates.idle).toEqual({
195-
"https://kinesis.us-west-2.amazonaws.com/": {
208+
[endpoint]: {
196209
sessions: [],
197210
},
198211
});

0 commit comments

Comments
 (0)