Skip to content

Commit 5d6da9a

Browse files
authored
fix: tests not working with DB connection (#1047)
### Summary - change ssl rejectUnauthorized to check if host is localhost πŸ”’ - update database URLs in test environment to use localhost instead of 127.0.0.1 🌐
1 parent 456436d commit 5d6da9a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

β€Žsrc/helpers/mysql.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ hubConfig.connectTimeout = 60e3;
1919
hubConfig.acquireTimeout = 60e3;
2020
hubConfig.timeout = 60e3;
2121
hubConfig.charset = 'utf8mb4';
22-
hubConfig.ssl = { rejectUnauthorized: true };
22+
hubConfig.ssl = { rejectUnauthorized: hubConfig.host !== 'localhost' };
2323

2424
const hubDB = mysql.createPool(hubConfig);
2525

@@ -34,7 +34,7 @@ sequencerConfig.connectTimeout = 60e3;
3434
sequencerConfig.acquireTimeout = 60e3;
3535
sequencerConfig.timeout = 60e3;
3636
sequencerConfig.charset = 'utf8mb4';
37-
sequencerConfig.ssl = { rejectUnauthorized: true };
37+
sequencerConfig.ssl = { rejectUnauthorized: hubConfig.host !== 'localhost' };
3838

3939
const sequencerDB = mysql.createPool(sequencerConfig);
4040

β€Žtest/.env.testβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
HUB_DATABASE_URL=mysql://root:root@127.0.0.1:3306/hub_test
2-
SEQ_DATABASE_URL=mysql://root:root@127.0.0.1:3306/hub_test
1+
HUB_DATABASE_URL=mysql://root:root@localhost:3306/hub_test
2+
SEQ_DATABASE_URL=mysql://root:root@localhost:3306/hub_test
33
NODE_ENV=test

0 commit comments

Comments
Β (0)