wait for app after update
This commit is contained in:
parent
14b03a09f9
commit
80b959f101
@ -89,7 +89,7 @@ Cloudron.prototype.waitForApp = function (appId) {
|
|||||||
// wait for app to come up
|
// wait for app to come up
|
||||||
process.stdout.write('Waiting for app to come up.');
|
process.stdout.write('Waiting for app to come up.');
|
||||||
|
|
||||||
while (true) {
|
for (var i = 0; i < 40; i++) {
|
||||||
sleep(10);
|
sleep(10);
|
||||||
process.stdout.write('.');
|
process.stdout.write('.');
|
||||||
var res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).end();
|
var res = request.get(this._origin + '/api/v1/apps/'+ appId).query({ access_token: this._credentials.accessToken }).end();
|
||||||
@ -100,6 +100,8 @@ Cloudron.prototype.waitForApp = function (appId) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert.strictEqual(res.body.installationState, 'installed');
|
||||||
|
assert.strictEqual(res.body.runState, 'running');
|
||||||
};
|
};
|
||||||
|
|
||||||
Cloudron.prototype.setCredentials = function (password, accessToken) {
|
Cloudron.prototype.setCredentials = function (password, accessToken) {
|
||||||
@ -163,7 +165,7 @@ Cloudron.prototype.update = function (toVersion) {
|
|||||||
console.log('Update started'.green);
|
console.log('Update started'.green);
|
||||||
|
|
||||||
process.stdout.write('Waiting for update.');
|
process.stdout.write('Waiting for update.');
|
||||||
for (var i = 0; i < 30; i++) {
|
for (var i = 0; i < 40; i++) {
|
||||||
sleep(10);
|
sleep(10);
|
||||||
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
res = request.get(this._origin + '/api/v1/cloudron/status').end();
|
||||||
if (res.statusCode === 200 && res.body.version === toVersion) {
|
if (res.statusCode === 200 && res.body.version === toVersion) {
|
||||||
|
@ -97,6 +97,10 @@ describe('Cloudron update testing', function () {
|
|||||||
cloudron.update(toVersion);
|
cloudron.update(toVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('runs the app', function () {
|
||||||
|
cloudron.waitForApp(appId);
|
||||||
|
});
|
||||||
|
|
||||||
it('can check the addons', function () {
|
it('can check the addons', function () {
|
||||||
var res = request.post('https://' + location + '-' + box.domain + '/check_addons').end();
|
var res = request.post('https://' + location + '-' + box.domain + '/check_addons').end();
|
||||||
assert.strictEqual(res.statusCode, 200);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
Loading…
Reference in New Issue
Block a user