test cloning with our test app

This commit is contained in:
Girish Ramakrishnan 2016-10-03 14:13:03 -07:00
parent 512e9d682b
commit 3c4103032d
1 changed files with 21 additions and 7 deletions

View File

@ -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 () {