remove httpPort
we can just use container IP instead of all this httpPort exporting magic. this is also required for exposing httpPaths feature (we have to otherwise have multiple httpPorts).
This commit is contained in:
@@ -14,7 +14,6 @@ var appdb = require('../appdb.js'),
|
||||
expect = require('expect.js'),
|
||||
fs = require('fs'),
|
||||
js2xml = require('js2xmlparser').parse,
|
||||
net = require('net'),
|
||||
nock = require('nock'),
|
||||
paths = require('../paths.js'),
|
||||
settings = require('../settings.js'),
|
||||
@@ -87,13 +86,12 @@ var APP = {
|
||||
domain: DOMAIN_0.domain,
|
||||
fqdn: DOMAIN_0.domain + '.' + 'applocation',
|
||||
manifest: MANIFEST,
|
||||
containerId: null,
|
||||
httpPort: 4567,
|
||||
containerId: 'someid',
|
||||
portBindings: null,
|
||||
accessRestriction: null,
|
||||
memoryLimit: 0,
|
||||
mailboxDomain: DOMAIN_0.domain,
|
||||
alternateDomains: []
|
||||
alternateDomains: [],
|
||||
};
|
||||
|
||||
var awsHostedZones;
|
||||
@@ -132,28 +130,18 @@ describe('apptask', function () {
|
||||
], done);
|
||||
});
|
||||
|
||||
it('reserve port', function (done) {
|
||||
apptask._reserveHttpPort(APP, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(APP.httpPort).to.be.a('number');
|
||||
var client = net.connect(APP.httpPort);
|
||||
client.on('connect', function () { done(new Error('Port is not free:' + APP.httpPort)); });
|
||||
client.on('error', function () { done(); });
|
||||
});
|
||||
});
|
||||
|
||||
it('configure nginx correctly', function (done) {
|
||||
apptask._configureReverseProxy(APP, function () {
|
||||
apptask._configureReverseProxy(APP, function (error) {
|
||||
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + APP.id + '.conf'));
|
||||
// expect(error).to.be(null); // this fails because nginx cannot be restarted
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('unconfigure nginx', function (done) {
|
||||
apptask._unconfigureReverseProxy(APP, function () {
|
||||
apptask._unconfigureReverseProxy(APP, function (error) {
|
||||
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + APP.id + '.conf'));
|
||||
// expect(error).to.be(null); // this fails because nginx cannot be restarted
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -112,6 +112,7 @@ describe('retention policy', function () {
|
||||
expect(b[3].keepReason).to.be(undefined);
|
||||
});
|
||||
|
||||
// if you are debugging this test, it's because of some timezone issue with all the hour substraction!
|
||||
it('2 daily, 1 weekly', function () {
|
||||
let b = [
|
||||
{ id: '0', state: backups.BACKUP_STATE_NORMAL, creationTime: moment().toDate() },
|
||||
|
||||
@@ -397,7 +397,6 @@ describe('database', function () {
|
||||
location: 'some-location-0',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: { version: '0.1', dockerImage: 'docker/app0', healthCheckPath: '/', httpPort: 80, title: 'app0' },
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { port: { hostPort: 5678, type: 'tcp' } },
|
||||
health: null,
|
||||
@@ -869,7 +868,6 @@ describe('database', function () {
|
||||
location: 'some-location-0',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: { version: '0.1', dockerImage: 'docker/app0', healthCheckPath: '/', httpPort: 80, title: 'app0' },
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { port: { hostPort: 5678, type: 'tcp' } },
|
||||
health: null,
|
||||
@@ -905,7 +903,6 @@ describe('database', function () {
|
||||
location: 'some-location-1',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: { version: '0.2', dockerImage: 'docker/app1', healthCheckPath: '/', httpPort: 80, title: 'app1' },
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { },
|
||||
health: null,
|
||||
@@ -1009,7 +1006,6 @@ describe('database', function () {
|
||||
APP_0.location = 'some-other-location';
|
||||
APP_0.manifest.version = '0.2';
|
||||
APP_0.accessRestriction = '';
|
||||
APP_0.httpPort = 1337;
|
||||
APP_0.memoryLimit = 1337;
|
||||
APP_0.cpuShares = 1024;
|
||||
|
||||
@@ -1019,7 +1015,6 @@ describe('database', function () {
|
||||
domain: APP_0.domain,
|
||||
manifest: APP_0.manifest,
|
||||
accessRestriction: APP_0.accessRestriction,
|
||||
httpPort: APP_0.httpPort,
|
||||
memoryLimit: APP_0.memoryLimit,
|
||||
cpuShares: APP_0.cpuShares
|
||||
};
|
||||
@@ -1036,15 +1031,6 @@ describe('database', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('getByHttpPort succeeds', function (done) {
|
||||
appdb.getByHttpPort(APP_0.httpPort, function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result).to.be.an('object');
|
||||
expect(_.omit(result, ['creationTime', 'updateTime', 'ts', 'healthTime','resetTokenCreationTime'])).to.be.eql(APP_0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('update of nonexisting app fails', function (done) {
|
||||
appdb.update(APP_1.id, { installationState: APP_1.installationState, location: APP_1.location }, function (error) {
|
||||
expect(error).to.be.a(BoxError);
|
||||
|
||||
@@ -74,7 +74,6 @@ var APP_0 = {
|
||||
location: 'some-location-0',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: { version: '0.1', dockerImage: 'docker/app0', healthCheckPath: '/', httpPort: 80, title: 'app0' },
|
||||
httpPort: null,
|
||||
containerId: 'someContainerId',
|
||||
portBindings: { port: 5678 },
|
||||
health: null,
|
||||
|
||||
@@ -233,7 +233,6 @@ describe('updatechecker - app - manual (email)', function () {
|
||||
}
|
||||
}
|
||||
},
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { PORT: 5678 },
|
||||
healthy: null,
|
||||
@@ -342,7 +341,6 @@ describe('updatechecker - app - automatic (no email)', function () {
|
||||
}
|
||||
}
|
||||
},
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { PORT: 5678 },
|
||||
healthy: null,
|
||||
@@ -407,7 +405,6 @@ describe('updatechecker - app - automatic free (email)', function () {
|
||||
}
|
||||
}
|
||||
},
|
||||
httpPort: null,
|
||||
containerId: null,
|
||||
portBindings: { PORT: 5678 },
|
||||
healthy: null,
|
||||
|
||||
Reference in New Issue
Block a user