Skip to content

Commit 661a3a1

Browse files
committed
test: fix async test
1 parent b0d8935 commit 661a3a1

File tree

5 files changed

+13
-65
lines changed

5 files changed

+13
-65
lines changed

.github/workflows/database-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107

108108
services:
109109
mysql:
110-
image: mysql:5.7.37
110+
image: mysql:8.0.42
111111
ports:
112112
- "3306:3306"
113113
env:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
# mysql
33
mysql:
4-
image: "mysql:5.7.37"
4+
image: "mysql:8.0.42"
55
container_name: "typeorm-mysql"
66
ports:
77
- "3306:3306"

package-lock.json

Lines changed: 0 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"test": "npm run compile && npm run test:fast --",
8989
"test:ci": "mocha --bail",
9090
"test:fast": "mocha",
91+
"typecheck": "tsc --noEmit",
9192
"watch": "tsc --watch"
9293
},
9394
"dependencies": {
@@ -141,7 +142,6 @@
141142
"mocha": "^10.8.2",
142143
"mongodb": "^6.15.0",
143144
"mssql": "^11.0.1",
144-
"mysql": "^2.18.1",
145145
"mysql2": "^3.14.0",
146146
"nyc": "^17.1.0",
147147
"oracledb": "^6.8.0",

test/functional/driver/mysql/connection-options/enable-query-timeout.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ describe("driver > mysql > connection options > enableQueryTimeout", () => {
1616
dropSchema: true,
1717
enabledDrivers: ["mysql"],
1818
}
19-
const timeoutMs = 500
20-
const longQueryTimeSec = 1
19+
const timeoutMs = 10
20+
const longQueryTimeSec = 0.02
2121
const shortQueryTimeSec = 0.005
2222

2323
describe("when enableQueryTimeout is true", () => {
@@ -34,8 +34,8 @@ describe("driver > mysql > connection options > enableQueryTimeout", () => {
3434
beforeEach(() => reloadTestingDatabases(dataSources))
3535
after(() => closeTestingConnections(dataSources))
3636

37-
it("should throw a query execution timeout error for the query when it exceeds the maxQueryExecutionTime", async () => {
38-
await Promise.all(
37+
it("should throw a query execution timeout error for the query when it exceeds the maxQueryExecutionTime", () =>
38+
Promise.all(
3939
dataSources.map(async (dataSource) => {
4040
await expect(
4141
dataSource.manager
@@ -51,19 +51,17 @@ describe("driver > mysql > connection options > enableQueryTimeout", () => {
5151
)
5252
})
5353
}),
54-
)
55-
})
54+
))
5655

57-
it("should not throw a query execution timeout error for the query when it runs within the maxQueryExecutionTime", async () => {
58-
await Promise.all(
56+
it("should not throw a query execution timeout error for the query when it runs within the maxQueryExecutionTime", async () =>
57+
Promise.all(
5958
dataSources.map(async (dataSource) => {
6059
await expect(
6160
dataSource.manager
6261
.sql`SELECT SLEEP(${shortQueryTimeSec})`,
6362
).to.be.eventually.fulfilled
6463
}),
65-
)
66-
})
64+
))
6765
})
6866

6967
describe("when enableQueryTimeout is not provided", () => {
@@ -78,15 +76,14 @@ describe("driver > mysql > connection options > enableQueryTimeout", () => {
7876

7977
after(() => closeTestingConnections(datasources))
8078

81-
it("should not throw a query execution timeout error", () => {
79+
it("should not throw a query execution timeout error", () =>
8280
Promise.all(
8381
datasources.map(async (dataSource) => {
8482
await expect(
8583
dataSource.manager
8684
.sql`SELECT SLEEP(${longQueryTimeSec})`,
8785
).to.eventually.be.fulfilled
8886
}),
89-
)
90-
})
87+
))
9188
})
9289
})

0 commit comments

Comments
 (0)