@@ -70,7 +70,7 @@ function cleanup(done) {
|
||||
], done);
|
||||
}
|
||||
|
||||
describe('updatechecker - box - manual (email)', function () {
|
||||
describe('updatechecker - box', function () {
|
||||
before(function (done) {
|
||||
safe.fs.unlinkSync(paths.UPDATE_CHECKER_FILE);
|
||||
|
||||
@@ -102,7 +102,7 @@ describe('updatechecker - box - manual (email)', function () {
|
||||
|
||||
updatechecker.checkForUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().box).to.be(null);
|
||||
expect(updatechecker.getUpdateInfo().box).to.not.be.ok();
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
@@ -123,11 +123,11 @@ describe('updatechecker - box - manual (email)', function () {
|
||||
expect(updatechecker.getUpdateInfo().box.sourceTarballUrl).to.be('box.tar.gz');
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
checkMails(0, done); // it seems we stopped sending mails for box updates!
|
||||
});
|
||||
});
|
||||
|
||||
it('bad response offers nothing', function (done) {
|
||||
it('bad response offers whatever was last valid', function (done) {
|
||||
nock.cleanAll();
|
||||
|
||||
var scope = nock('http://localhost:4444')
|
||||
@@ -137,42 +137,8 @@ describe('updatechecker - box - manual (email)', function () {
|
||||
|
||||
updatechecker.checkForUpdates({ automatic: false }, function (error) {
|
||||
expect(error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().box).to.be(null);
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatechecker - box - automatic (no email)', function () {
|
||||
before(function (done) {
|
||||
mailer._mailQueue = [];
|
||||
|
||||
async.series([
|
||||
database.initialize,
|
||||
settings._setApiServerOrigin.bind(null, 'http://localhost:4444'),
|
||||
cron.startJobs,
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
users.createOwner.bind(null, USER_0.username, USER_0.password, USER_0.email, USER_0.displayName, AUDIT_SOURCE),
|
||||
settingsdb.set.bind(null, settings.CLOUDRON_TOKEN_KEY, 'atoken'),
|
||||
], done);
|
||||
});
|
||||
|
||||
after(cleanup);
|
||||
|
||||
it('new version', function (done) {
|
||||
nock.cleanAll();
|
||||
|
||||
var scope = nock('http://localhost:4444')
|
||||
.get('/api/v1/boxupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: 'atoken', automatic: false })
|
||||
.reply(200, { version: UPDATE_VERSION, changelog: [''], sourceTarballUrl: 'box.tar.gz', sourceTarballSigUrl: 'box.tar.gz.sig', boxVersionsUrl: 'box.versions', boxVersionsSigUrl: 'box.versions.sig' } );
|
||||
|
||||
updatechecker.checkForUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().box.version).to.be(UPDATE_VERSION);
|
||||
expect(updatechecker.getUpdateInfo().box.sourceTarballUrl).to.be('box.tar.gz');
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
@@ -180,42 +146,7 @@ describe('updatechecker - box - automatic (no email)', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatechecker - box - automatic free (email)', function () {
|
||||
before(function (done) {
|
||||
mailer._mailQueue = [];
|
||||
|
||||
async.series([
|
||||
database.initialize,
|
||||
settings._setApiServerOrigin.bind(null, 'http://localhost:4444'),
|
||||
cron.startJobs,
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
users.createOwner.bind(null, USER_0.username, USER_0.password, USER_0.email, USER_0.displayName, AUDIT_SOURCE),
|
||||
settingsdb.set.bind(null, settings.CLOUDRON_TOKEN_KEY, 'atoken'),
|
||||
], done);
|
||||
});
|
||||
|
||||
after(cleanup);
|
||||
|
||||
it('new version', function (done) {
|
||||
nock.cleanAll();
|
||||
|
||||
var scope = nock('http://localhost:4444')
|
||||
.get('/api/v1/boxupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: 'atoken', automatic: false })
|
||||
.reply(200, { version: UPDATE_VERSION, changelog: [''], sourceTarballUrl: 'box.tar.gz', sourceTarballSigUrl: 'box.tar.gz.sig', boxVersionsUrl: 'box.versions', boxVersionsSigUrl: 'box.versions.sig' } );
|
||||
|
||||
updatechecker.checkForUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().box.version).to.be(UPDATE_VERSION);
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatechecker - app - manual (email)', function () {
|
||||
describe('updatechecker - app', function () {
|
||||
var APP_0 = {
|
||||
id: 'appid-0',
|
||||
appStoreId: 'io.cloudron.app',
|
||||
@@ -271,7 +202,7 @@ describe('updatechecker - app - manual (email)', function () {
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({});
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({});
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
@@ -288,7 +219,7 @@ describe('updatechecker - app - manual (email)', function () {
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({});
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({});
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(0, done);
|
||||
@@ -305,7 +236,7 @@ describe('updatechecker - app - manual (email)', function () {
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({ 'appid-0': { manifest: { version: '2.0.0', changelog: '* some changes' }, unstable: false } });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({ 'appid-0': { manifest: { version: '2.0.0', changelog: '* some changes' }, unstable: false } });
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(1, done);
|
||||
@@ -317,136 +248,8 @@ describe('updatechecker - app - manual (email)', function () {
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({ });
|
||||
expect(updatechecker.getUpdateInfo()).to.eql({ });
|
||||
checkMails(0, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatechecker - app - automatic (no email)', function () {
|
||||
var APP_0 = {
|
||||
id: 'appid-0',
|
||||
appStoreId: 'io.cloudron.app',
|
||||
installationState: apps.ISTATE_PENDING_INSTALL,
|
||||
error: null,
|
||||
runState: 'running',
|
||||
location: 'some-location-0',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: {
|
||||
version: '1.0.0', dockerImage: 'docker/app0', healthCheckPath: '/', httpPort: 80, title: 'app0',
|
||||
tcpPorts: {
|
||||
PORT: {
|
||||
description: 'this is a port that i expose',
|
||||
containerPort: '1234'
|
||||
}
|
||||
}
|
||||
},
|
||||
containerId: null,
|
||||
portBindings: { PORT: 5678 },
|
||||
healthy: null,
|
||||
accessRestriction: null,
|
||||
memoryLimit: 0,
|
||||
mailboxName: 'mail',
|
||||
mailboxDomain: DOMAIN_0.domain
|
||||
};
|
||||
|
||||
before(function (done) {
|
||||
mailer._mailQueue = [];
|
||||
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
settings._setApiServerOrigin.bind(null, 'http://localhost:4444'),
|
||||
cron.startJobs,
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
users.createOwner.bind(null, USER_0.username, USER_0.password, USER_0.email, USER_0.displayName, AUDIT_SOURCE),
|
||||
appdb.add.bind(null, APP_0.id, APP_0.appStoreId, APP_0.manifest, APP_0.location, APP_0.domain, apps._translatePortBindings(APP_0.portBindings, APP_0.manifest), APP_0),
|
||||
settings.setAutoupdatePattern.bind(null, '00 00 1,3,5,23 * * *'),
|
||||
settingsdb.set.bind(null, settings.CLOUDRON_TOKEN_KEY, 'atoken'),
|
||||
], done);
|
||||
});
|
||||
|
||||
after(cleanup);
|
||||
|
||||
it('offers new version', function (done) {
|
||||
nock.cleanAll();
|
||||
|
||||
var scope = nock('http://localhost:4444')
|
||||
.get('/api/v1/appupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: 'atoken', appId: APP_0.appStoreId, appVersion: APP_0.manifest.version, automatic: false })
|
||||
.reply(200, { manifest: { version: '2.0.0', changelog: 'c' } } );
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({ 'appid-0': { manifest: { version: '2.0.0', changelog: 'c' }, unstable: false } });
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(1, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('updatechecker - app - automatic free (email)', function () {
|
||||
var APP_0 = {
|
||||
id: 'appid-0',
|
||||
appStoreId: 'io.cloudron.app',
|
||||
installationState: apps.ISTATE_PENDING_INSTALL,
|
||||
error: null,
|
||||
runState: 'running',
|
||||
location: 'some-location-0',
|
||||
domain: DOMAIN_0.domain,
|
||||
manifest: {
|
||||
version: '1.0.0', dockerImage: 'docker/app0', healthCheckPath: '/', httpPort: 80, title: 'app0',
|
||||
tcpPorts: {
|
||||
PORT: {
|
||||
description: 'this is a port that i expose',
|
||||
containerPort: '1234'
|
||||
}
|
||||
}
|
||||
},
|
||||
containerId: null,
|
||||
portBindings: { PORT: 5678 },
|
||||
healthy: null,
|
||||
accessRestriction: null,
|
||||
memoryLimit: 0,
|
||||
mailboxName: 'mail',
|
||||
mailboxDomain: DOMAIN_0.domain
|
||||
};
|
||||
|
||||
before(function (done) {
|
||||
mailer._mailQueue = [];
|
||||
|
||||
async.series([
|
||||
database.initialize,
|
||||
database._clear,
|
||||
settings._setApiServerOrigin.bind(null, 'http://localhost:4444'),
|
||||
cron.startJobs,
|
||||
domains.add.bind(null, DOMAIN_0.domain, DOMAIN_0, AUDIT_SOURCE),
|
||||
settings.setAdminLocation.bind(null, DOMAIN_0.domain, 'my.' + DOMAIN_0.domain),
|
||||
users.createOwner.bind(null, USER_0.username, USER_0.password, USER_0.email, USER_0.displayName, AUDIT_SOURCE),
|
||||
appdb.add.bind(null, APP_0.id, APP_0.appStoreId, APP_0.manifest, APP_0.location, APP_0.domain, apps._translatePortBindings(APP_0.portBindings, APP_0.manifest), APP_0),
|
||||
settings.setAutoupdatePattern.bind(null, '00 00 1,3,5,23 * * *'),
|
||||
settingsdb.set.bind(null, settings.CLOUDRON_TOKEN_KEY, 'atoken'),
|
||||
], done);
|
||||
});
|
||||
|
||||
after(cleanup);
|
||||
|
||||
it('offers new version', function (done) {
|
||||
nock.cleanAll();
|
||||
|
||||
var scope = nock('http://localhost:4444')
|
||||
.get('/api/v1/appupdate')
|
||||
.query({ boxVersion: constants.VERSION, accessToken: 'atoken', appId: APP_0.appStoreId, appVersion: APP_0.manifest.version, automatic: false })
|
||||
.reply(200, { manifest: { version: '2.0.0', changelog: 'c' } } );
|
||||
|
||||
updatechecker._checkAppUpdates({ automatic: false }, function (error) {
|
||||
expect(!error).to.be.ok();
|
||||
expect(updatechecker.getUpdateInfo().apps).to.eql({ 'appid-0': { manifest: { version: '2.0.0', changelog: 'c' }, unstable: false } });
|
||||
expect(scope.isDone()).to.be.ok();
|
||||
|
||||
checkMails(1, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user