add the check for updates hook

This commit is contained in:
Girish Ramakrishnan 2016-06-07 20:31:02 -07:00
parent 869795a70e
commit 64fd830db1
2 changed files with 9 additions and 1 deletions

View File

@ -615,3 +615,9 @@ Cloudron.prototype.checkSieveScript = function (owner, callback) {
socket.on('end', function () { });
socket.on('error', callback);
};
Cloudron.prototype.checkForUpdates = function () {
request.post(this._origin + '/api/v1/cloudron/check_for_updates')
.query({ access_token: this._credentials.accessToken })
.end();
};

View File

@ -114,11 +114,13 @@ describe('Cloudron update testing', function () {
it('can update to new version', function () {
console.log('Wait for cloudron to get the update');
sleep(60 * 10); // give it 5 mins to autoupdate the box and the app
cloudron.checkForUpdates();
sleep(60 * 5); // give it 5 mins to autoupdate the box and the app
cloudron.waitForUpdate(nextVersion);
});
it('auto updates the app with new version', function () {
cloudron.checkForUpdates();
sleep(60 * 5); // give it 5 mins to autoupdate the box and the app
cloudron.waitForApp(appId, common.TESTAPP_VERSION);
});