Test: Use cartodb-psql to reset connections instead of calling node-postgres directly

- Avoids an issue with newer npm not finding node-postgres during the tests
as it was required directly but not declared in package.json.
- Avoids an issue with the torque timeouts tests
This commit is contained in:
Raul Marin
2018-06-06 13:18:28 +02:00
parent f732ed970b
commit db946b93ec
2 changed files with 4 additions and 11 deletions
+3 -3
View File
@@ -1268,9 +1268,6 @@ TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callb
const dbuser = _.template(global.environment.postgres_auth_user, { user_id: 1 });
const publicuser = global.environment.postgres.user;
// we need to guarantee all new connections have the new settings
helper.cleanPGPoolConnections();
const psql = new PSQL({
user: 'postgres',
dbname: dbname,
@@ -1278,6 +1275,9 @@ TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callb
port: global.environment.postgres.port
});
// we need to guarantee all new connections have the new settings
psql.end();
step(
function configureTimeouts () {
const timeoutSQLs = [
+1 -8
View File
@@ -13,7 +13,6 @@ var lzmaWorker = new LZMA();
var redis = require('redis');
var log4js = require('log4js');
var pg = require('pg');
const setICUEnvVariable = require('../../lib/cartodb/utils/icu_data_env_setter');
// set environment specific variables
@@ -148,11 +147,6 @@ afterEach(function(done) {
});
});
function cleanPGPoolConnections () {
// TODO: this method will be replaced by psql.end
pg.end();
}
function deleteRedisKeys(keysToDelete, callback) {
if (Object.keys(keysToDelete).length === 0) {
@@ -215,6 +209,5 @@ module.exports = {
checkSurrogateKey: checkSurrogateKey,
checkCache: checkCache,
rmdirRecursiveSync: rmdirRecursiveSync,
configureMetadata,
cleanPGPoolConnections
configureMetadata
};