Skip to content

Commit daeafe8

Browse files
authored
Make tests pass in github codespaces (#2437)
* Make tests pass in github codespaces There were a few tests which didn't specify a host or port which wasn't working well inside the codespaces docker environment. Added host & port where required. Also noticed one test wasn't actually _testing_, it was just `console.log`-ing its output, so I added proper assertions there. Finally set `PGTESTNOSSL: true` in the codespaces environment until I can get the postgres docker container configured w/ SSL...which I will do l8r. * lint
1 parent a109e8c commit daeafe8

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.devcontainer/docker-compose.yml

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ services:
2525
PGUSER: user
2626
PGDATABASE: data
2727
PGHOST: db
28+
# set this to true in the development environment until I can get SSL setup on the
29+
# docker postgres instance
30+
PGTESTNOSSL: true
2831

2932
# Overrides default command so things don't shut down after the process ends.
3033
command: sleep infinity

packages/pg/test/integration/client/connection-parameter-tests.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const assert = require('assert')
12
const helper = require('../test-helper')
23
const suite = new helper.Suite()
34
const { Client } = helper.pg
@@ -8,6 +9,7 @@ suite.test('it sends options', async () => {
89
})
910
await client.connect()
1011
const { rows } = await client.query('SHOW default_transaction_isolation')
11-
console.log(rows)
12+
assert.strictEqual(rows.length, 1)
13+
assert.strictEqual(rows[0].default_transaction_isolation, 'serializable')
1214
await client.end()
1315
})

packages/pg/test/integration/client/promise-api-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ suite.test('valid connection completes promise', () => {
2020
})
2121

2222
suite.test('invalid connection rejects promise', (done) => {
23-
const client = new pg.Client({ host: 'alksdjflaskdfj' })
23+
const client = new pg.Client({ host: 'alksdjflaskdfj', port: 1234 })
2424
return client.connect().catch((e) => {
2525
assert(e instanceof Error)
2626
done()

packages/pg/test/integration/gh-issues/2079-tests.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let makeTerminatingBackend = (byte) => {
3232

3333
suite.test('SSL connection error allows event loop to exit', (done) => {
3434
const port = makeTerminatingBackend('N')
35-
const client = new helper.pg.Client({ ssl: 'require', port })
35+
const client = new helper.pg.Client({ ssl: 'require', port, host: 'localhost' })
3636
// since there was a connection error the client's socket should be closed
3737
// and the event loop will have no refs and exit cleanly
3838
client.connect((err) => {
@@ -43,7 +43,7 @@ suite.test('SSL connection error allows event loop to exit', (done) => {
4343

4444
suite.test('Non "S" response code allows event loop to exit', (done) => {
4545
const port = makeTerminatingBackend('X')
46-
const client = new helper.pg.Client({ ssl: 'require', port })
46+
const client = new helper.pg.Client({ ssl: 'require', host: 'localhost', port })
4747
// since there was a connection error the client's socket should be closed
4848
// and the event loop will have no refs and exit cleanly
4949
client.connect((err) => {

0 commit comments

Comments
 (0)