Avoid nxdomain during tests and always specify app id

This commit is contained in:
Johannes Zellner 2018-09-03 17:44:23 +02:00
parent d37044f8e0
commit 1b15db85e3

View file

@ -234,8 +234,8 @@ return done();
function addCustomFile(done) {
fs.writeFileSync('/tmp/customfile.txt', 'GOGS TEST', 'utf8');
execSync('cloudron exec -- mkdir -p /app/data/custom/public');
execSync('cloudron push /tmp/customfile.txt /app/data/custom/public/customfile.txt');
execSync(`cloudron exec --app ${app.id} -- mkdir -p /app/data/custom/public`);
execSync(`cloudron push --app ${app.id} /tmp/customfile.txt /app/data/custom/public/customfile.txt`);
fs.unlinkSync('/tmp/customfile.txt');
done();
}
@ -351,12 +351,17 @@ return done();
it('can clone the url', cloneRepo);
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
it('move to different location', function () {
it('move to different location', function (done) {
//browser.manage().deleteAllCookies(); // commented because of error "'Network.deleteCookie' wasn't found"
execSync('cloudron configure --wait --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object');
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron configure --wait --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object');
done();
});
});
it('can login', login);
@ -365,8 +370,12 @@ return done();
it('can clone the url', cloneRepo);
it('file exists in repo', function () { expect(fs.existsSync(repodir + '/newfile')).to.be(true); });
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
it('uninstall app', function (done) {
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
// check if the _first_ login via email succeeds
@ -379,8 +388,12 @@ return done();
login(function (error) {
if (error) return done(error);
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
});
@ -408,7 +421,11 @@ return done();
it('can clone the url', cloneRepo);
it('file exists in cloned repo', fileExists);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
it('uninstall app', function (done) {
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
done();
});
});
});