Skip to content

Commit 3d905bc

Browse files
committed
test: fix hanging integration tests
1 parent 4946887 commit 3d905bc

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

tests/integration/container/tests/mysql_pool.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ describe("mysql pool integration tests", () => {
109109
expect(result[0][0].query_id).toBe(index + 1);
110110
});
111111
expect(connectionIds.size).toBeLessThanOrEqual(10);
112+
await client.end();
112113
},
113114
1320000
114115
);
@@ -128,6 +129,7 @@ describe("mysql pool integration tests", () => {
128129
const currentConnectionId = await auroraTestUtility.queryInstanceId(client);
129130
expect(await auroraTestUtility.isDbInstanceWriter(currentConnectionId)).toBe(true);
130131
expect(currentConnectionId).not.toBe(initialWriterId);
132+
await client.end();
131133
},
132134
1320000
133135
);
@@ -156,6 +158,8 @@ describe("mysql pool integration tests", () => {
156158
await expect(async () => {
157159
await poolClient.query("SELECT * FROM test_table WHERE id = 1");
158160
}).rejects.toThrow();
161+
162+
await client.end();
159163
},
160164
1320000
161165
);
@@ -192,6 +196,8 @@ describe("mysql pool integration tests", () => {
192196
const currentConnectionId = await auroraTestUtility.queryInstanceId(client);
193197
expect(await auroraTestUtility.isDbInstanceWriter(currentConnectionId)).toBe(true);
194198
expect(currentConnectionId).not.toBe(initialWriterId);
199+
200+
await client.end();
195201
});
196202

197203
itIfMySQL(
@@ -237,6 +243,8 @@ describe("mysql pool integration tests", () => {
237243
await poolClient.query("COMMIT");
238244
await poolClient.release();
239245
}
246+
247+
await client.end();
240248
},
241249
1320000
242250
);
@@ -295,6 +303,8 @@ describe("mysql pool integration tests", () => {
295303
await poolClient.query("COMMIT");
296304
await poolClient.release();
297305
}
306+
307+
await client.end();
298308
},
299309
1320000
300310
);

tests/integration/container/tests/pg_pool.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ afterEach(async () => {
6767
if (client !== null) {
6868
try {
6969
await client.end();
70+
await PluginManager.releaseResources();
7071
} catch (error) {
7172
// pass
7273
}
@@ -92,6 +93,8 @@ describe("pg pool integration tests", () => {
9293
});
9394

9495
expect(connectionIds.size).toBe(10);
96+
97+
await client.end();
9598
});
9699

97100
itIfPG("sequential execution", async () => {
@@ -112,6 +115,8 @@ describe("pg pool integration tests", () => {
112115
});
113116

114117
expect(connectionIds.size).toBeLessThanOrEqual(10);
118+
119+
await client.end();
115120
});
116121

117122
itIfPG("failover writer during concurrent query execution", async () => {
@@ -131,6 +136,8 @@ describe("pg pool integration tests", () => {
131136
const currentConnectionId = await auroraTestUtility.queryInstanceId(client);
132137
expect(await auroraTestUtility.isDbInstanceWriter(currentConnectionId)).toBe(true);
133138
expect(currentConnectionId).not.toBe(initialWriterId);
139+
140+
await client.end();
134141
});
135142

136143
itIfPG("failover writer during multi-statement transaction", async () => {
@@ -159,6 +166,7 @@ describe("pg pool integration tests", () => {
159166
await expect(async () => {
160167
await client.query("SELECT * FROM test_table WHERE id = 1");
161168
}).rejects.toThrow();
169+
await client.end();
162170
});
163171

164172
itIfPG(
@@ -195,8 +203,7 @@ describe("pg pool integration tests", () => {
195203
await poolClient1.query("COMMIT");
196204
await poolClient2.query("COMMIT");
197205

198-
poolClient1.release();
199-
poolClient2.release();
206+
await client.end();
200207
},
201208
1320000
202209
);
@@ -236,8 +243,7 @@ describe("pg pool integration tests", () => {
236243

237244
await Promise.all([poolClient1.query("COMMIT"), poolClient2.query("COMMIT")]);
238245

239-
poolClient1.release();
240-
poolClient2.release();
246+
await client.end();
241247
},
242248
1320000
243249
);

0 commit comments

Comments
 (0)