Skip to content

Commit 740d0a6

Browse files
committed
Merge pull request #577 from letsface/bump-aws-tests-timeout
bump up timeout for tests against AWS from 5s to 15s
2 parents 238e75b + 8fb28c5 commit 740d0a6

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

test/integration/client/heroku-pgpass-tests.js

+15-12
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ var config = {
2222
ssl: true
2323
};
2424

25-
// connect & disconnect from heroku
26-
pg.connect(config, assert.success(function(client, done) {
27-
client.query('SELECT NOW() as time', assert.success(function(res) {
28-
assert(res.rows[0].time.getTime());
29-
30-
// cleanup ... remove the env variable
31-
delete process.env.PGPASSFILE;
32-
33-
done();
34-
pg.end();
35-
}))
36-
}));
25+
test('uses password file when PGPASSFILE env variable is set', function() {
26+
// connect & disconnect from heroku
27+
pg.connect(config, assert.calls(function(err, client, done) {
28+
assert.isNull(err);
29+
client.query('SELECT NOW() as time', assert.success(function(res) {
30+
assert(res.rows[0].time.getTime());
31+
32+
// cleanup ... remove the env variable
33+
delete process.env.PGPASSFILE;
34+
35+
done();
36+
pg.end();
37+
}))
38+
}));
39+
});

test/integration/client/heroku-ssl-tests.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ var config = {
1515
ssl: true
1616
};
1717

18-
//connect & disconnect from heroku
19-
pg.connect(config, assert.success(function(client, done) {
20-
client.query('SELECT NOW() as time', assert.success(function(res) {
21-
assert(res.rows[0].time.getTime());
22-
done();
23-
pg.end();
24-
}))
25-
}));
18+
test('connection with config ssl = true', function() {
19+
//connect & disconnect from heroku
20+
pg.connect(config, assert.calls(function(err, client, done) {
21+
assert.isNull(err);
22+
client.query('SELECT NOW() as time', assert.success(function(res) {
23+
assert(res.rows[0].time.getTime());
24+
done();
25+
pg.end();
26+
}))
27+
}));
28+
});

test/test-helper.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ assert.lengthIs = function(actual, expectedLength) {
133133

134134
var expect = function(callback, timeout) {
135135
var executed = false;
136+
timeout = timeout || parseInt(process.env.TEST_TIMEOUT) || 5000;
136137
var id = setTimeout(function() {
137-
assert.ok(executed, "Expected execution of function to be fired");
138-
}, timeout || 5000)
138+
assert.ok(executed,
139+
"Expected execution of function to be fired within " + timeout
140+
+ " milliseconds " +
141+
+ " (hint: export TEST_TIMEOUT=<timeout in milliseconds>"
142+
+ " to change timeout globally)");
143+
}, timeout)
139144

140145
if(callback.length < 3) {
141146
return function(err, queryResult) {

0 commit comments

Comments
 (0)