From 64fd830db1deec5f8de4a472288956482ebbcabd Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 7 Jun 2016 20:31:02 -0700 Subject: [PATCH] add the check for updates hook --- cloudron.js | 6 ++++++ test/cloudron-autoupdate-sfo1-test.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cloudron.js b/cloudron.js index a433b5c..216a7cf 100644 --- a/cloudron.js +++ b/cloudron.js @@ -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(); +}; diff --git a/test/cloudron-autoupdate-sfo1-test.js b/test/cloudron-autoupdate-sfo1-test.js index 8e87b03..f9553ca 100644 --- a/test/cloudron-autoupdate-sfo1-test.js +++ b/test/cloudron-autoupdate-sfo1-test.js @@ -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); });