Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

bump up timeout for tests against AWS from 5s to 15s #577

Merged
merged 2 commits into from

2 participants

@rngadam

More often than not, connection to the AWS test server will timeout for locations with poor Internet connectivity (China..).

@brianc
Owner

You're in china? That's rad! How would you feel about instead of modifying particular tests, making the timeout an environment variable like TEST_TIMEOUT? Then assert.calls could be like:

var timeout = parseInt(process.env.TEST_TIMEOUT) || 5000;

That might help on travis as well where things run really slow as well. Then it can be configured in one place for every test. None of the tests actually test the timeliness of anything, the duration of the timeout was strictly arbitrarily set to 5000.

@rngadam

Modified to add global variable parsing in test-helper!

BTW, if you're interested in coming to Shanghai, ping me by email ;-).

@brianc
Owner

Nice! :+1:

Thanks for the offer! If I do come over I will definitely take you up on it. :)

Thanks for the PR too! :+1:

@brianc brianc merged commit 740d0a6 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 25, 2014
  1. bump up timeout for tests against AWS from 5s to 15s

    Ricky Ng-Adam authored
Commits on May 2, 2014
This page is out of date. Refresh to see the latest.
View
27 test/integration/client/heroku-pgpass-tests.js
@@ -22,15 +22,18 @@ var config = {
ssl: true
};
-// connect & disconnect from heroku
-pg.connect(config, assert.success(function(client, done) {
- client.query('SELECT NOW() as time', assert.success(function(res) {
- assert(res.rows[0].time.getTime());
-
- // cleanup ... remove the env variable
- delete process.env.PGPASSFILE;
-
- done();
- pg.end();
- }))
-}));
+test('uses password file when PGPASSFILE env variable is set', function() {
+ // connect & disconnect from heroku
+ pg.connect(config, assert.calls(function(err, client, done) {
+ assert.isNull(err);
+ client.query('SELECT NOW() as time', assert.success(function(res) {
+ assert(res.rows[0].time.getTime());
+
+ // cleanup ... remove the env variable
+ delete process.env.PGPASSFILE;
+
+ done();
+ pg.end();
+ }))
+ }));
+});
View
19 test/integration/client/heroku-ssl-tests.js
@@ -15,11 +15,14 @@ var config = {
ssl: true
};
-//connect & disconnect from heroku
-pg.connect(config, assert.success(function(client, done) {
- client.query('SELECT NOW() as time', assert.success(function(res) {
- assert(res.rows[0].time.getTime());
- done();
- pg.end();
- }))
-}));
+test('connection with config ssl = true', function() {
+ //connect & disconnect from heroku
+ pg.connect(config, assert.calls(function(err, client, done) {
+ assert.isNull(err);
+ client.query('SELECT NOW() as time', assert.success(function(res) {
+ assert(res.rows[0].time.getTime());
+ done();
+ pg.end();
+ }))
+ }));
+});
View
9 test/test-helper.js
@@ -133,9 +133,14 @@ assert.lengthIs = function(actual, expectedLength) {
var expect = function(callback, timeout) {
var executed = false;
+ timeout = timeout || parseInt(process.env.TEST_TIMEOUT) || 5000;
var id = setTimeout(function() {
- assert.ok(executed, "Expected execution of function to be fired");
- }, timeout || 5000)
+ assert.ok(executed,
+ "Expected execution of function to be fired within " + timeout
+ + " milliseconds " +
+ + " (hint: export TEST_TIMEOUT=<timeout in milliseconds>"
+ + " to change timeout globally)");
+ }, timeout)
if(callback.length < 3) {
return function(err, queryResult) {
Something went wrong with that request. Please try again.