fix tests
This commit is contained in:
+5
-118
@@ -5,131 +5,18 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var appdb = require('../appdb.js'),
|
||||
apps = require('../apps.js'),
|
||||
apptask = require('../apptask.js'),
|
||||
async = require('async'),
|
||||
blobs = require('../blobs.js'),
|
||||
database = require('../database.js'),
|
||||
domains = require('../domains.js'),
|
||||
const apptask = require('../apptask.js'),
|
||||
common = require('./common.js'),
|
||||
expect = require('expect.js'),
|
||||
fs = require('fs'),
|
||||
paths = require('../paths.js'),
|
||||
settings = require('../settings.js'),
|
||||
userdb = require('../userdb.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': 'test@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': { }
|
||||
}
|
||||
};
|
||||
|
||||
const DOMAIN_0 = {
|
||||
domain: 'example.com',
|
||||
zoneName: 'example.com',
|
||||
provider: 'route53',
|
||||
config: {
|
||||
accessKeyId: 'accessKeyId',
|
||||
secretAccessKey: 'secretAccessKey',
|
||||
endpoint: 'http://localhost:5353'
|
||||
},
|
||||
fallbackCertificate: null,
|
||||
tlsConfig: { provider: 'letsencrypt-staging' },
|
||||
wellKnown: null
|
||||
};
|
||||
|
||||
let AUDIT_SOURCE = { ip: '1.2.3.4' };
|
||||
|
||||
var ADMIN = {
|
||||
id: 'admin123',
|
||||
username: 'admin123',
|
||||
password: 'secret',
|
||||
email: 'admin@me.com',
|
||||
fallbackEmail: 'admin@me.com',
|
||||
salt: 'morton',
|
||||
createdAt: 'sometime back',
|
||||
resetToken: '',
|
||||
displayName: '',
|
||||
role: 'owner',
|
||||
source: ''
|
||||
};
|
||||
|
||||
var APP = {
|
||||
id: 'appid',
|
||||
appStoreId: 'appStoreId',
|
||||
installationState: apps.ISTATE_PENDING_INSTALL,
|
||||
runState: 'running',
|
||||
location: 'applocation',
|
||||
domain: DOMAIN_0.domain,
|
||||
fqdn: DOMAIN_0.domain + '.' + 'applocation',
|
||||
manifest: MANIFEST,
|
||||
containerId: 'someid',
|
||||
portBindings: null,
|
||||
accessRestriction: null,
|
||||
memoryLimit: 0,
|
||||
mailboxDomain: DOMAIN_0.domain,
|
||||
alternateDomains: [],
|
||||
aliasDomains: []
|
||||
};
|
||||
const { APP } = common;
|
||||
|
||||
describe('apptask', function () {
|
||||
before(function (done) {
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
blobs.initSecrets,
|
||||
settings.setDashboardLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
userdb.add.bind(null, ADMIN.id, ADMIN),
|
||||
appdb.add.bind(null, APP.id, APP.appStoreId, APP.manifest, APP.location, APP.domain, APP.portBindings, APP)
|
||||
], done);
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
async.series([
|
||||
database._clear,
|
||||
database.uninitialize
|
||||
], done);
|
||||
});
|
||||
|
||||
it('configure nginx correctly', function (done) {
|
||||
apptask._configureReverseProxy(APP, function (error) {
|
||||
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + APP.id + '.conf'));
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('unconfigure nginx', function (done) {
|
||||
apptask._unconfigureReverseProxy(APP, function (error) {
|
||||
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + APP.id + '.conf'));
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
before(common.setup);
|
||||
after(common.cleanup);
|
||||
|
||||
it('create volume', function (done) {
|
||||
apptask._createAppDir(APP, function (error) {
|
||||
|
||||
Reference in New Issue
Block a user