Skip to content

Commit a0551d8

Browse files
committed
[misc] mysql 8 error detection correction
1 parent a6a09f5 commit a0551d8

File tree

4 files changed

+58
-13
lines changed

4 files changed

+58
-13
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ matrix:
5858
env: DB=mariadb:10.4 BENCH=1 SKIP_LEAK=1
5959
- node_js: "12"
6060
env: DB=mariadb:10.4 MAXSCALE_VERSION=2.2.9 TEST_PORT=4007 TEST_USER=bob TEXT_DATABASE=test2 SKIP_LEAK=1
61-
6261
- node_js: "12"
6362
env: DB=mariadb:10.1 SKIP_LEAK=1
6463
- node_js: "12"
@@ -70,7 +69,7 @@ matrix:
7069
- node_js: "12"
7170
env: DB=mysql:5.7 SKIP_LEAK=1
7271
- node_js: "12"
73-
env: DB=mysql:8.0 SKIP_LEAK=1
72+
env: DB=mysql:8.0 SKIP_LEAK=1 ADDITIONAL_CONF=--default-authentication-plugin=mysql_native_password
7473

7574
notifications:
7675
email: false

test/integration/test-connection-opts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ describe('connection option', () => {
438438
.catch(err => {
439439
assert.isTrue(
440440
err.message.includes(
441-
'Can only use timeout for MariaDB server after 10.1.1. timeout value:'
441+
'Can only use queryTimeout for MariaDB server after 10.1.1. queryTimeout value:'
442442
)
443443
);
444444
assert.equal(err.errno, 45038);

test/integration/test-pool-callback.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ describe('Pool callback', () => {
2121
done(new Error('must have thrown error'));
2222
} else {
2323
assert.isTrue(
24-
err.errno === 1524 || err.errno === 1045 || err.errno === 1698 || err.errno === 45028,
24+
err.errno === 1524 ||
25+
err.errno === 1045 ||
26+
err.errno === 1698 ||
27+
err.errno === 45028 ||
28+
err.errno === 45025,
2529
err.message
2630
);
2731
pool.end();
@@ -41,7 +45,9 @@ describe('Pool callback', () => {
4145
this.timeout(10000);
4246
const pool = base.createPoolCallback({
4347
connectionLimit: 3,
44-
user: 'wrongAuthentication'
48+
user: 'wrongAuthentication',
49+
acquireTimeout: 4000,
50+
initializationTimeout: 2000
4551
});
4652
pool.getConnection(err => {
4753
if (!err) {
@@ -53,8 +59,12 @@ describe('Pool callback', () => {
5359
done(new Error('must have thrown error'));
5460
} else {
5561
assert.isTrue(
56-
err.errno === 1524 || err.errno === 1045 || err.errno === 1698 || err.errno === 45028,
57-
err.message
62+
err.errno === 1524 ||
63+
err.errno === 1045 ||
64+
err.errno === 1698 ||
65+
err.errno === 45028 ||
66+
err.errno === 45025,
67+
err.errno + ' - ' + err.message
5868
);
5969
done();
6070
}

test/integration/test-pool.js

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ describe('Pool', () => {
8585
done(new Error('must have thrown error'));
8686
})
8787
.catch(err => {
88-
assert.isTrue(err.errno === 1524 || err.errno === 1045 || err.errno === 1698, err.message);
88+
assert.isTrue(
89+
err.errno === 1524 ||
90+
err.errno === 1045 ||
91+
err.errno === 1698 ||
92+
err.errno === 45025 ||
93+
err.errno === 45028,
94+
err.message
95+
);
8996
pool
9097
.query('SELECT 3')
9198
.then(() => {
@@ -95,7 +102,11 @@ describe('Pool', () => {
95102
.catch(err => {
96103
pool.end();
97104
assert.isTrue(
98-
err.errno === 1524 || err.errno === 1045 || err.errno === 1698 || err.errno === 45028,
105+
err.errno === 1524 ||
106+
err.errno === 1045 ||
107+
err.errno === 1698 ||
108+
err.errno === 45028 ||
109+
err.errno === 45025,
99110
err.message
100111
);
101112
done();
@@ -108,7 +119,14 @@ describe('Pool', () => {
108119
done(new Error('must have thrown error'));
109120
})
110121
.catch(err => {
111-
assert.isTrue(err.errno === 1524 || err.errno === 1045 || err.errno === 1698, err.message);
122+
assert.isTrue(
123+
err.errno === 1524 ||
124+
err.errno === 1045 ||
125+
err.errno === 1698 ||
126+
err.errno === 45025 ||
127+
err.errno === 45028,
128+
err.message
129+
);
112130
});
113131
});
114132

@@ -126,7 +144,14 @@ describe('Pool', () => {
126144
done(new Error('must have thrown error'));
127145
})
128146
.catch(err => {
129-
assert.isTrue(err.errno === 1524 || err.errno === 1045 || err.errno === 1698, err.message);
147+
assert.isTrue(
148+
err.errno === 1524 ||
149+
err.errno === 1045 ||
150+
err.errno === 1698 ||
151+
err.errno === 45028 ||
152+
err.errno === 45025,
153+
err.message
154+
);
130155
pool
131156
.getConnection()
132157
.then(() => {
@@ -136,7 +161,11 @@ describe('Pool', () => {
136161
.catch(err => {
137162
pool.end();
138163
assert.isTrue(
139-
err.errno === 1524 || err.errno === 1045 || err.errno === 1698 || err.errno === 45028,
164+
err.errno === 1524 ||
165+
err.errno === 1045 ||
166+
err.errno === 1698 ||
167+
err.errno === 45028 ||
168+
err.errno === 45025,
140169
err.message
141170
);
142171
done();
@@ -149,7 +178,14 @@ describe('Pool', () => {
149178
done(new Error('must have thrown error'));
150179
})
151180
.catch(err => {
152-
assert.isTrue(err.errno === 1524 || err.errno === 1045 || err.errno === 1698, err.message);
181+
assert.isTrue(
182+
err.errno === 1524 ||
183+
err.errno === 1045 ||
184+
err.errno === 1698 ||
185+
err.errno === 45028 ||
186+
err.errno === 45025,
187+
err.message
188+
);
153189
});
154190
});
155191

0 commit comments

Comments
 (0)