Remove PostgreSQL from health checks
This way the health checks will only check for Redis and Mapnik initialization. An empty tile without layers or datasources is generated.
This commit is contained in:
@@ -8,19 +8,12 @@ var server = new CartodbWindshaft(serverOptions);
|
||||
var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||
|
||||
|
||||
[true, false].forEach(function(cdbQueryTablesFromPostgresEnabledValue) {
|
||||
|
||||
global.environment.enabledFeatures = {cdbQueryTablesFromPostgres: cdbQueryTablesFromPostgresEnabledValue};
|
||||
|
||||
suite('health checks - postgres=' + cdbQueryTablesFromPostgresEnabledValue, function () {
|
||||
|
||||
suite('health checks', function () {
|
||||
beforeEach(function (done) {
|
||||
global.environment.health = {
|
||||
enabled: true,
|
||||
username: 'localhost',
|
||||
query: "SELECT 1::int as interactivity_id, '0101000020110F0000EE866678CE876D41466F35C2EC1150C1'::geometry as geom, 'Lorem ipsum dolor sit amet' as label",
|
||||
srid: 3857,
|
||||
geometry_field: 'geom',
|
||||
z: 0,
|
||||
x: 0,
|
||||
y: 0
|
||||
@@ -28,18 +21,6 @@ var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||
done();
|
||||
});
|
||||
|
||||
if (!cdbQueryTablesFromPostgresEnabledValue) {
|
||||
var sqlApiServer;
|
||||
|
||||
before(function (done) {
|
||||
sqlApiServer = new SQLAPIEmu(global.environment.sqlapi.port, done);
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
sqlApiServer.close(done);
|
||||
});
|
||||
}
|
||||
|
||||
var healthCheckRequest = {
|
||||
url: '/health',
|
||||
method: 'GET',
|
||||
@@ -48,27 +29,6 @@ var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||
}
|
||||
};
|
||||
|
||||
test('returns 200 and ok=true with disabled configuration', function (done) {
|
||||
global.environment.health.enabled = false;
|
||||
|
||||
assert.response(server,
|
||||
healthCheckRequest,
|
||||
{
|
||||
status: 200
|
||||
},
|
||||
function (res, err) {
|
||||
assert.ok(!err);
|
||||
|
||||
var parsed = JSON.parse(res.body);
|
||||
|
||||
assert.equal(parsed.enabled, false);
|
||||
assert.ok(parsed.ok);
|
||||
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
test('returns 200 and ok=true with enabled configuration', function (done) {
|
||||
assert.response(server,
|
||||
healthCheckRequest,
|
||||
@@ -76,6 +36,7 @@ var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||
status: 200
|
||||
},
|
||||
function (res, err) {
|
||||
console.log(res.body);
|
||||
assert.ok(!err);
|
||||
|
||||
var parsed = JSON.parse(res.body);
|
||||
@@ -111,31 +72,5 @@ var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||
);
|
||||
});
|
||||
|
||||
test.skip('fails for wrong query', function (done) {
|
||||
global.environment.health.query = 'select wadus query';
|
||||
|
||||
assert.response(server,
|
||||
healthCheckRequest,
|
||||
{
|
||||
status: 503
|
||||
},
|
||||
function (res, err) {
|
||||
assert.ok(!err);
|
||||
|
||||
var parsed = JSON.parse(res.body);
|
||||
|
||||
assert.equal(parsed.enabled, true);
|
||||
assert.equal(parsed.ok, false);
|
||||
|
||||
assert.ok(parsed.result.redis.ok);
|
||||
|
||||
assert.equal(parsed.result.postgresql.ok, false);
|
||||
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user