diff --git a/tools/config.js b/tools/config.js index 95245d93e4..ce9b833b8d 100644 --- a/tools/config.js +++ b/tools/config.js @@ -220,6 +220,10 @@ _.extend(exports, { return getUniverse(); }, + getDeployHostname: function () { + return process.env.DEPLOY_HOSTNAME || "meteor.com"; + }, + // Deploy URL for MDG free hosting, eg 'https://deploy.meteor.com'. getDeployUrl: function () { var host; diff --git a/tools/test-utils.js b/tools/test-utils.js index 50d05f3164..ed7a7aec45 100644 --- a/tools/test-utils.js +++ b/tools/test-utils.js @@ -46,6 +46,7 @@ exports.createAndDeployLegacyApp = function (sandbox, password) { ensureLegacyReleaseDownloaded(sandbox); + name = name + "." + config.getDeployHostname(); var runArgs = ['deploy', '--release', '0.7.0.1', name]; if (password) runArgs.push('-P'); @@ -61,7 +62,7 @@ exports.createAndDeployLegacyApp = function (sandbox, password) { } run.waitSecs(90); - run.match('Now serving at ' + name + '.meteor.com'); + 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; @@ -70,6 +71,10 @@ exports.createAndDeployLegacyApp = function (sandbox, password) { 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); @@ -94,6 +99,11 @@ exports.createAndDeployApp = function (sandbox, options) { var name = options.appName || randomAppName(); sandbox.createApp(name, options.templateApp || 'empty'); sandbox.cd(name); + + if (name.indexOf(".") === -1) { + name = name + "." + config.getDeployHostname(); + } + var runArgs = ['deploy', name]; if (options.settingsFile) { runArgs.push('--settings'); @@ -101,13 +111,17 @@ exports.createAndDeployApp = function (sandbox, options) { } var run = sandbox.run.apply(sandbox, runArgs); run.waitSecs(90); - run.match('Now serving at ' + name + '.meteor.com'); + run.match('Now serving at ' + name); run.waitSecs(10); run.expectExit(0); return name; }; exports.cleanUpApp = function (sandbox, name) { + if (name.indexOf(".") === -1) { + name = name + "." + config.getDeployHostname(); + } + var run = sandbox.run('deploy', '-D', name); run.waitSecs(90); run.match('Deleted'); @@ -149,6 +163,11 @@ exports.registrationUrlRegexp = registrationUrlRegexp; exports.deployWithNewEmail = function (s, email, appName) { s.createApp('deployapp', 'empty'); s.cd('deployapp'); + + if (appName.indexOf(".") === -1) { + appName = appName + "." + config.getDeployHostname(); + } + var run = s.run('deploy', appName); run.waitSecs(exports.accountsCommandTimeoutSecs); run.matchErr('Email:'); diff --git a/tools/tests/deploy-auth.js b/tools/tests/deploy-auth.js index 94e08a3b24..c3f7144e50 100644 --- a/tools/tests/deploy-auth.js +++ b/tools/tests/deploy-auth.js @@ -4,6 +4,7 @@ var testUtils = require('../test-utils.js'); var files = require('../files.js'); var Sandbox = selftest.Sandbox; var httpHelpers = require('../http-helpers.js'); +var config = require("../config.js"); var commandTimeoutSecs = testUtils.accountsCommandTimeoutSecs; @@ -13,7 +14,8 @@ selftest.define('deploy - expired credentials', ['net', 'slow'], function () { // username. On the next deploy, we should get an email prompt // followed by a registration email, not a username prompt. var email = testUtils.randomUserEmail(); - var appName = testUtils.randomAppName(); + var appName = testUtils.randomAppName() + "." + + config.getDeployHostname(); var token = testUtils.deployWithNewEmail(s, email, appName); var sessionFile = s.readSessionFile(); testUtils.logout(s); @@ -34,7 +36,8 @@ selftest.define('deploy - expired credentials', ['net', 'slow'], function () { // Create an account, set a username, expire the login token, and // deploy again. We should get a username/password prompt. email = testUtils.randomUserEmail(); - appName = testUtils.randomAppName(); + appName = testUtils.randomAppName() + "." + + config.getDeployHostname(); username = testUtils.randomString(10); token = testUtils.deployWithNewEmail(s, email, appName); testUtils.registerWithToken(token, username, @@ -70,7 +73,8 @@ selftest.define('deploy - bad arguments', [], function () { run.expectExit(1); // Deploy outside of an app directory - run = s.run('deploy', testUtils.randomAppName()); + run = s.run('deploy', testUtils.randomAppName() + "." + + config.getDeployHostname()); run.matchErr('not in a Meteor project directory'); run.expectExit(1); }); @@ -107,7 +111,7 @@ selftest.define('deploy - logged in', ['net', 'slow'], function () { // deploy to the legacy app. var run = sandbox.run('deploy', noPasswordLegacyApp); run.waitSecs(90); - run.match('Now serving at ' + noPasswordLegacyApp + '.meteor.com'); + run.match('Now serving at ' + noPasswordLegacyApp); run.expectExit(0); // And we should have claimed the app by deploying to it. run = sandbox.run('claim', noPasswordLegacyApp); @@ -137,7 +141,7 @@ selftest.define('deploy - logged in', ['net', 'slow'], function () { run.expectExit(0); run = sandbox.run('deploy', passwordLegacyApp); run.waitSecs(90); - run.match('Now serving at ' + passwordLegacyApp + '.meteor.com'); + run.match('Now serving at ' + passwordLegacyApp); run.expectExit(0); // Clean up testUtils.cleanUpApp(sandbox, passwordLegacyApp); @@ -189,7 +193,7 @@ selftest.define('deploy - logged out', ['net', 'slow'], function () { run.matchErr('Password:'); run.write('testtest\n'); run.waitSecs(90); - run.match('Now serving at ' + appName + '.meteor.com'); + run.match('Now serving at ' + appName); run.expectExit(0); testUtils.cleanUpApp(s, appName); @@ -237,7 +241,7 @@ selftest.define('deploy - logged out', ['net', 'slow'], function () { // 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. - appName = testUtils.randomAppName(); + appName = testUtils.randomAppName() + "." + config.getDeployHostname(); var email = testUtils.randomUserEmail(); run = s.run('deploy', appName); run.waitSecs(commandTimeoutSecs); @@ -252,7 +256,7 @@ selftest.define('deploy - logged out', ['net', 'slow'], function () { testUtils.cleanUpApp(s, appName); testUtils.logout(s); // Now that we've created a user, try to deploy a new app. - appName = testUtils.randomAppName(); + appName = testUtils.randomAppName() + "." + config.getDeployHostname(); run = s.run('deploy', appName); run.waitSecs(commandTimeoutSecs); run.matchErr('Email:'); diff --git a/tools/tests/deploy-settings.js b/tools/tests/deploy-settings.js index 97dd32ecea..5bc429b9d4 100644 --- a/tools/tests/deploy-settings.js +++ b/tools/tests/deploy-settings.js @@ -9,10 +9,10 @@ var httpHelpers = require('../http-helpers.js'); // if the settings aren't found after a timeout. var checkForSettings = function (appName, settings, timeoutSecs) { var timer = setTimeout(function () { - throw new Error('Expected settings not found on app ', appName); + throw new Error('Expected settings not found on app ' + appName); }, timeoutSecs * 1000); while (true) { - var result = httpHelpers.request('http://' + appName + '.meteor.com'); + var result = httpHelpers.request('http://' + appName); // XXX This is brittle; the test will break if we start formatting the // __meteor_runtime_config__ JS differently. Ideally we'd do something diff --git a/tools/tests/list-sites.js b/tools/tests/list-sites.js index 033544a14c..e35c96653c 100644 --- a/tools/tests/list-sites.js +++ b/tools/tests/list-sites.js @@ -2,6 +2,7 @@ var _ = require('underscore'); var selftest = require('../selftest.js'); var testUtils = require('../test-utils.js'); var files = require('../files.js'); +var config = require("../config.js"); var Sandbox = selftest.Sandbox; var commandTimeoutSecs = testUtils.accountsCommandTimeoutSecs; @@ -9,8 +10,8 @@ var commandTimeoutSecs = testUtils.accountsCommandTimeoutSecs; selftest.define('list-sites - basic', ['net', 'slow'], function () { var s = new Sandbox; var email = testUtils.randomUserEmail(); - var appName1 = testUtils.randomAppName(); - var appName2 = testUtils.randomAppName(); + var appName1 = testUtils.randomAppName() + "." + config.getDeployHostname(); + var appName2 = testUtils.randomAppName() + "." + config.getDeployHostname(); testUtils.deployWithNewEmail(s, email, appName1); testUtils.createAndDeployApp(s, { appName: appName2 }); var sortedApps = [appName1, appName2]; @@ -19,8 +20,8 @@ selftest.define('list-sites - basic', ['net', 'slow'], function () { var run = s.run('list-sites'); run.waitSecs(commandTimeoutSecs); _.each(sortedApps, function (app) { - run.read(app + '.meteor.com\n'); - }) + run.read(app + '\n'); + }); run.expectEnd(); run.expectExit(0); testUtils.cleanUpApp(s, appName1); diff --git a/tools/tests/logs-mongo-auth.js b/tools/tests/logs-mongo-auth.js index 88751ad0d9..9ee9fd7ffb 100644 --- a/tools/tests/logs-mongo-auth.js +++ b/tools/tests/logs-mongo-auth.js @@ -2,6 +2,7 @@ var _ = require('underscore'); var selftest = require('../selftest.js'); var Sandbox = selftest.Sandbox; var testUtils = require('../test-utils.js'); +var config = require("../config.js"); // XXX need to make sure that mother doesn't clean up: // 'legacy-password-app-for-selftest' @@ -25,6 +26,11 @@ var loginTimeoutSecs = 2; // - password: the password to use if given a login prompt (defaults to // 'testtest'); var logsOrMongoForApp = function (sandbox, command, appName, options) { + + if (appName.indexOf(".") === -1) { + appName = appName + "." + config.getDeployHostname(); + } + var runArgs = [command, appName]; var matchString; if (command === 'mongo') {