more config.fqdn() removal in tests

This commit is contained in:
Girish Ramakrishnan
2018-01-24 14:58:37 -08:00
parent 45456f2cf7
commit ee66893875
10 changed files with 47 additions and 73 deletions
+2 -2
View File
@@ -236,7 +236,7 @@ describe('Apps', function () {
expect(error).to.be(null);
expect(app).to.be.ok();
expect(app.iconUrl).to.be(null);
expect(app.fqdn).to.eql(APP_0.location + '.' + config.fqdn());
expect(app.fqdn).to.eql(APP_0.location + '.' + DOMAIN_0.domain);
expect(app.memoryLimit).to.eql(0);
done();
});
@@ -248,7 +248,7 @@ describe('Apps', function () {
expect(apps).to.be.an(Array);
expect(apps[0].id).to.be(APP_0.id);
expect(apps[0].iconUrl).to.be(null);
expect(apps[0].fqdn).to.eql(APP_0.location + '.' + config.fqdn());
expect(apps[0].fqdn).to.eql(APP_0.location + '.' + DOMAIN_0.domain);
done();
});
});
+26 -26
View File
@@ -22,31 +22,31 @@ var addons = require('../addons.js'),
_ = require('underscore');
var MANIFEST = {
"id": "io.cloudron.test",
"author": "The Presidents Of the United States Of America",
"title": "test title",
"description": "test description",
"tagline": "test rocks",
"website": "http://test.cloudron.io",
"contactEmail": "support@cloudron.io",
"version": "0.1.0",
"manifestVersion": 1,
"dockerImage": "cloudron/test:25.2.0",
"healthCheckPath": "/",
"httpPort": 7777,
"tcpPorts": {
"ECHO_SERVER_PORT": {
"title": "Echo Server Port",
"description": "Echo server",
"containerPort": 7778
'id': 'io.cloudron.test',
'author': 'The Presidents Of the United States Of America',
'title': 'test title',
'description': 'test description',
'tagline': 'test rocks',
'website': 'http://test.cloudron.io',
'contactEmail': 'support@cloudron.io',
'version': '0.1.0',
'manifestVersion': 1,
'dockerImage': 'cloudron/test:25.2.0',
'healthCheckPath': '/',
'httpPort': 7777,
'tcpPorts': {
'ECHO_SERVER_PORT': {
'title': 'Echo Server Port',
'description': 'Echo server',
'containerPort': 7778
}
},
'addons': {
'oauth': { },
'redis': { },
'mysql': { },
'postgresql': { }
}
},
"addons": {
"oauth": { },
"redis": { },
"mysql": { },
"postgresql": { }
}
};
const DOMAIN_0 = {
@@ -89,7 +89,7 @@ describe('apptask', function () {
awsHostedZones = {
HostedZones: [{
Id: '/hostedzone/ZONEID',
Name: config.fqdn() + '.',
Name: `${DOMAIN_0.domain}.`,
CallerReference: '305AFD59-9D73-4502-B020-F4E6F889CB30',
ResourceRecordSetCount: 2,
ChangeInfo: {
@@ -243,7 +243,7 @@ describe('apptask', function () {
.get('/2013-04-01/hostedzone')
.times(2)
.reply(200, js2xml('ListHostedZonesResponse', awsHostedZones, { wrapHandlers: { HostedZones: () => 'HostedZone'} }))
.get('/2013-04-01/hostedzone/ZONEID/rrset?maxitems=1&name=applocation.' + config.fqdn() + '.&type=A')
.get('/2013-04-01/hostedzone/ZONEID/rrset?maxitems=1&name=applocation.' + DOMAIN_0.domain + '.&type=A')
.reply(200, js2xml('ListResourceRecordSetsResponse', { ResourceRecordSets: [ ] }, { 'Content-Type': 'application/xml' }))
.post('/2013-04-01/hostedzone/ZONEID/rrset/')
.reply(200, js2xml('ChangeResourceRecordSetsResponse', { ChangeInfo: { Id: 'RRID', Status: 'INSYNC' } }));
+3 -3
View File
@@ -249,7 +249,7 @@ describe('dns provider', function () {
.post('/v2/domains/' + config.zoneName() + '/records')
.reply(201, { domain_record: DOMAIN_RECORD_2_NEW });
domains.upsertDNSRecords('', config.fqdn(), 'TXT', [ DOMAIN_RECORD_2_NEW.data, DOMAIN_RECORD_1_NEW.data, DOMAIN_RECORD_3_NEW.data ], function (error, result) {
domains.upsertDNSRecords('', DOMAIN_0.domain, 'TXT', [ DOMAIN_RECORD_2_NEW.data, DOMAIN_RECORD_1_NEW.data, DOMAIN_RECORD_3_NEW.data ], function (error, result) {
expect(error).to.eql(null);
expect(result).to.eql('3352893');
expect(req1.isDone()).to.be.ok();
@@ -473,7 +473,7 @@ describe('dns provider', function () {
}
}]);
domains.upsertDNSRecords('', config.fqdn(), 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
domains.upsertDNSRecords('', DOMAIN_0.domain, 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
expect(error).to.eql(null);
expect(result).to.eql('/change/C2QLKQIWEI0BZF');
expect(awsAnswerQueue.length).to.eql(0);
@@ -614,7 +614,7 @@ describe('dns provider', function () {
zoneQueue.push([null, [ ]]); // getRecords
zoneQueue.push([null, {id: '3'}]);
domains.upsertDNSRecords('', config.fqdn(), 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
domains.upsertDNSRecords('', DOMAIN_0.domain, 'TXT', [ 'first', 'second', 'third' ], function (error, result) {
expect(error).to.eql(null);
expect(result).to.eql('3');
expect(zoneQueue.length).to.eql(0);
+2 -25
View File
@@ -15,6 +15,7 @@ var config = require('../config.js'),
server = require('../server.js');
var SERVER_URL = 'http://localhost:' + config.get('port');
var DOMAIN = 'example-server-test.com';
function cleanup(done) {
done();
@@ -25,7 +26,7 @@ describe('Server', function () {
before(function () {
config._reset();
config.setFqdn('example-server-test.com');
config.setFqdn(DOMAIN);
config.set('provider', 'notcaas'); // otherwise, cron sets a caas timer for heartbeat causing the test to not quit
});
@@ -252,28 +253,4 @@ describe('Server', function () {
});
});
});
describe('heartbeat', function () {
var successfulHeartbeatGet;
before(function (done) {
server.start(done);
var scope = nock(config.apiServerOrigin());
successfulHeartbeatGet = scope.get('/api/v1/boxes/' + config.fqdn() + '/heartbeat');
successfulHeartbeatGet.reply(200);
});
after(function (done) {
server.stop(done);
nock.cleanAll();
});
it('sends heartbeat', function (done) {
setTimeout(function () {
expect(successfulHeartbeatGet.counter).to.equal(1);
done();
}, 100);
});
});
});