From 3c4103032d7e9c31079757927bf004e0b3a5664d Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 3 Oct 2016 14:13:03 -0700 Subject: [PATCH] test cloning with our test app --- test/app-flow-test.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/test/app-flow-test.js b/test/app-flow-test.js index bac1daf..adcaf41 100644 --- a/test/app-flow-test.js +++ b/test/app-flow-test.js @@ -71,16 +71,16 @@ describe('Application flow test', function () { cloudron.checkAddons(cloudron.appFqdn(location), owner); }); - function checkExposedPort(done) { + function checkExposedPort(port, done) { var client = new net.Socket(); var data = [ ]; - client.connect(5151, cloudron.appFqdn(location), function() { - console.log('connected to 5151'); + client.connect(port, cloudron.appFqdn(location), function() { + console.log('connected to ' + port); }); client.on('data', function (chunk) { data.push(chunk); }); client.on('close', function () { var response = Buffer.concat(data).toString('utf8'); - if (response === 'ECHO_SERVER_PORT=5151') return done(); + if (response === 'ECHO_SERVER_PORT=' + port) return done(); console.log('unexpected response:', response); done(new Error('bad response')); }); @@ -88,7 +88,7 @@ describe('Application flow test', function () { } it('can access exposed port', function (done) { - checkExposedPort(done); + checkExposedPort(5151, done); }); it('displays app graphs', function () { @@ -105,7 +105,7 @@ describe('Application flow test', function () { }); it('can access exposed port', function (done) { - checkExposedPort(done); + checkExposedPort(5151, done); }); it('can reboot the cloudron', function () { @@ -117,7 +117,21 @@ describe('Application flow test', function () { }); it('can access exposed port', function (done) { - checkExposedPort(done); + checkExposedPort(5151, done); + }); + + var cloneLocation; + it('can clone app', function () { + cloneLocation = location + 'clone'; + cloudron.cloneApp(appId, location + 'clone', { ECHO_SERVER_PORT: 5252 }); + }); + + it('can check the addons', function () { + cloudron.checkAddons(cloudron.appFqdn(cloneLocation), owner); + }); + + it('can access exposed port', function (done) { + checkExposedPort(5252, done); }); it('can uninstall app', function () {