Remove "deploy legacy app" tests

These tested a transition that occured in February. The tests are very
slow because each test does an uncached download of Meteor 0.7.0.1. We
are unlikely to break the logic that it tests and even if we do, it will
only affect users who haven't touched their apps since February.
This commit is contained in:
David Glasser
2014-11-22 10:56:28 -08:00
parent 8846a7acbd
commit 27d67fe379
3 changed files with 1 additions and 266 deletions

View File

@@ -29,67 +29,6 @@ exports.randomUserEmail = function () {
return 'selftest-user-' + randomString(15) + '@guerrillamail.com';
};
var ensureLegacyReleaseDownloaded = function (sandbox) {
// Ensure we have 0.7.0.1 downloaded. This version didn't actually support
// --get-ready for a built release, but it's an easy way to verify we're
// actually running an old version.
var run = sandbox.run('--release', '0.7.0.1', '--get-ready');
run.waitSecs(75);
run.matchErr('only works in a checkout\n');
run.expectExit(1);
};
// Creates an app and deploys it with an old release. 'password' is
// optional. Returns the name of the deployed app.
exports.createAndDeployLegacyApp = function (sandbox, password) {
var name = randomAppName();
sandbox.createApp(name, 'empty');
sandbox.cd(name);
ensureLegacyReleaseDownloaded(sandbox);
name = name + "." + config.getDeployHostname();
var runArgs = ['deploy', '--release', '0.7.0.1', name];
if (password)
runArgs.push('-P');
var run = sandbox.run.apply(sandbox, runArgs);
if (password) {
run.waitSecs(10);
run.match('New Password:');
run.write(password + '\n');
run.match('New Password (again):');
run.write(password + '\n');
}
run.waitSecs(90);
run.match('Now serving at ' + name);
// XXX: We should wait for it to exit with code 0, but it times out for some reason.
run.stop();
return name;
};
exports.cleanUpLegacyApp = function (sandbox, name, password) {
ensureLegacyReleaseDownloaded(sandbox);
if (name.indexOf(".") === -1) {
name = name + "." + config.getDeployHostname();
}
var run = sandbox.run('deploy', '--release', '0.7.0.1', '-D', name);
if (password) {
run.waitSecs(10);
run.matchErr('Password:');
run.write(password + '\n');
}
run.waitSecs(60);
run.match('Deleted');
// XXX same as above, we should be waiting for exit code 0, but the
// process appears to never exit.
run.stop();
};
// Creates an app and deploys it. Assumes the sandbox is already logged
// in. Returns the name of the deployed app. Options:
// - settingsFile: a path to a settings file to deploy with

View File

@@ -60,101 +60,4 @@ selftest.define("claim", ['net', 'slow'], function () {
waitAndError(run, "That site already belongs to you.");
testUtils.cleanUpApp(s, appName);
// Legacy sites.
var sLegacy;
if (files.inCheckout()) {
sLegacy = new Sandbox({
// Include a warehouse argument so that we can deploy apps with
// --release arguments.
warehouse: {
v1: { tools: 'tool1', latest: true }
}
});
} else {
sLegacy = new Sandbox;
}
// legacy w/pwd.
var pwd = testUtils.randomString(10);
var legacyApp = testUtils.createAndDeployLegacyApp(sLegacy, pwd);
run = s.run('claim', legacyApp);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password: ');
run.write('badpass\n');
run.waitSecs(commandTimeoutSecs);
run.matchErr("Couldn't claim site:");
run.expectExit(1);
run = s.run('claim', legacyApp);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password:');
run.write(pwd+"\n");
run.waitSecs(commandTimeoutSecs);
run.match("successfully transferred to your account");
run.expectExit(0);
testUtils.cleanUpApp(s, legacyApp);
// legacy w/o pwd.
legacyApp = testUtils.createAndDeployLegacyApp(sLegacy);
run = s.run('claim', legacyApp);
run.waitSecs(commandTimeoutSecs);
run.match("successfully transferred to your account");
run.expectExit(0);
// No site deployed.
run = s.run('claim', testUtils.randomAppName(20));
waitAndError(run, "There isn't a site deployed at that address.");
testUtils.cleanUpApp(s, legacyApp);
testUtils.logout(s);
});
selftest.define('claim - no username', ['net', 'slow'], function () {
var s = new Sandbox;
var sandboxWithWarehouse;
if (files.inCheckout()) {
sandboxWithWarehouse = new Sandbox({
// Include a warehouse argument so that we can deploy apps with
// --release arguments.
warehouse: {
v1: { tools: 'tool1', latest: true }
}
});
} else {
sandboxWithWarehouse = new Sandbox;
}
// We shouldn't be able to claim sites before we set a username.
var email = testUtils.randomUserEmail();
var username = testUtils.randomString(10);
var appName = testUtils.randomAppName();
var token = testUtils.deployWithNewEmail(s, email, appName);
var legacyAppName = testUtils.createAndDeployLegacyApp(
sandboxWithWarehouse,
'test'
);
var run = s.run('claim', legacyAppName);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password:');
run.write('test\n');
run.waitSecs(commandTimeoutSecs);
run.matchErr('You need to set a password');
run.matchErr(testUtils.registrationUrlRegexp);
run.expectExit(1);
// After we set a username, we should be able to claim sites.
testUtils.registerWithToken(token, username, 'testtest', email);
run = s.run('claim', legacyAppName);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password: ');
run.write('test\n');
run.waitSecs(commandTimeoutSecs);
run.match('transferred to your account');
run.expectExit(0);
testUtils.cleanUpApp(s, appName);
testUtils.cleanUpApp(s, legacyAppName);
testUtils.logout(s);
});

View File

@@ -80,72 +80,12 @@ selftest.define('deploy - bad arguments', [], function () {
});
selftest.define('deploy - logged in', ['net', 'slow'], function () {
// Create two sandboxes: one with a warehouse so that we can run
// --release, and one without a warehouse so that we run from the
// checkout or release that we started from.
// XXX Is having two sandboxes the only way to do this?
var sandbox = new Sandbox;
var sandboxWithWarehouse;
if (files.inCheckout()) {
sandboxWithWarehouse = new Sandbox({
// Include a warehouse arugment so that we can deploy apps with
// --release arguments.
warehouse: {
v1: { tools: 'tool1', latest: true }
}
});
} else {
sandboxWithWarehouse = new Sandbox;
}
sandbox.createApp('deployapp', 'empty');
sandbox.cd('deployapp');
// LEGACY APPS
// Deploy a legacy app with no password
var noPasswordLegacyApp = testUtils.createAndDeployLegacyApp(sandboxWithWarehouse);
testUtils.login(sandbox, 'test', 'testtest');
// Now, with our logged in current release, we should be able to
// deploy to the legacy app.
var run = sandbox.run('deploy', noPasswordLegacyApp);
run.waitSecs(90);
run.match('Now serving at http://' + noPasswordLegacyApp);
run.expectExit(0);
// And we should have claimed the app by deploying to it.
run = sandbox.run('claim', noPasswordLegacyApp);
run.waitSecs(commandTimeoutSecs);
run.matchErr('already belongs to you');
run.expectExit(1);
// Clean up
testUtils.cleanUpApp(sandbox, noPasswordLegacyApp);
// Deploy a legacy password-protected app
var passwordLegacyApp = testUtils.createAndDeployLegacyApp(
sandboxWithWarehouse,
'test'
);
// We shouldn't be able to deploy to this app without claiming it
run = sandbox.run('deploy', passwordLegacyApp);
run.waitSecs(commandTimeoutSecs);
run.matchErr('meteor claim');
run.expectExit(1);
// If we claim it, we should be able to deploy to it.
run = sandbox.run('claim', passwordLegacyApp);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password:');
run.write('test\n');
run.waitSecs(commandTimeoutSecs);
run.match('successfully transferred to your account');
run.expectExit(0);
run = sandbox.run('deploy', passwordLegacyApp);
run.waitSecs(90);
run.match('Now serving at http://' + passwordLegacyApp);
run.expectExit(0);
// Clean up
testUtils.cleanUpApp(sandbox, passwordLegacyApp);
// NON-LEGACY APPS
// Deploy an app.
@@ -154,7 +94,7 @@ selftest.define('deploy - logged in', ['net', 'slow'], function () {
// Try to deploy to it from a different account -- should fail.
testUtils.logout(sandbox);
testUtils.login(sandbox, 'testtest', 'testtest');
run = sandbox.run('deploy', appName);
var run = sandbox.run('deploy', appName);
run.waitSecs(commandTimeoutSecs);
run.matchErr('belongs to a different user');
run.expectExit(1);
@@ -170,14 +110,6 @@ selftest.define('deploy - logged in', ['net', 'slow'], function () {
selftest.define('deploy - logged out', ['net', 'slow'], function () {
var s = new Sandbox;
var sandboxWithWarehouse;
if (files.inCheckout()) {
sandboxWithWarehouse = new Sandbox({
warehouse: { v1: { tools: 'tool1', latest: true } }
});
} else {
sandboxWithWarehouse = new Sandbox;
}
testUtils.login(s, 'test', 'testtest');
var appName = testUtils.createAndDeployApp(s);
@@ -199,45 +131,6 @@ selftest.define('deploy - logged out', ['net', 'slow'], function () {
testUtils.logout(s);
// Any deploy command for a legacy app that isn't password-protected
// should prompt us to log in, and then should work.
var legacyNoPassword = testUtils.createAndDeployLegacyApp(
sandboxWithWarehouse
);
run = s.run('deploy', legacyNoPassword);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Email:');
run.write('test@test.com\n');
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password: ');
run.write('testtest\n');
run.waitSecs(90);
run.match('Now serving');
run.expectExit(0);
// Deploying to a legacy app that is password-protected should prompt
// us to log in, and then tell us about 'meteor claim'.
testUtils.logout(s);
var legacyPassword = testUtils.createAndDeployLegacyApp(
sandboxWithWarehouse,
'test'
);
run = s.run('deploy', legacyPassword);
run.waitSecs(commandTimeoutSecs);
run.matchErr('Email:');
// Log in with a username here to test that the email prompt also
// accepts emails. (We put an email in the email prompt above.)
run.write('test\n');
run.waitSecs(commandTimeoutSecs);
run.matchErr('Password:');
run.write('testtest\n');
run.waitSecs(commandTimeoutSecs);
run.matchErr('meteor claim');
run.expectExit(1);
testUtils.cleanUpLegacyApp(sandboxWithWarehouse, legacyPassword, 'test');
testUtils.logout(s);
// Deploying to a new app using a user that exists but has no password
// set should prompt us to set a password.
// First, create a user without a password.