Get a little farther in springboard test

This commit is contained in:
David Glasser
2014-10-17 09:52:22 -07:00
parent 96eebea575
commit 87f4a7826f
3 changed files with 31 additions and 8 deletions

View File

@@ -741,6 +741,12 @@ _.extend(RemoteCatalog.prototype, {
Console.debug("In remote catalog refresh");
if (process.env.METEOR_TEST_FAIL_RELEASE_DOWNLOAD === 'offline') {
var e = new Error;
e.errorType = 'DDP.ConnectionError';
throw e;
}
if (self.offline)
return false;

View File

@@ -786,6 +786,7 @@ Fiber(function () {
}
var alreadyRefreshed = false;
var refreshFailed = false;
if (! files.usesWarehouse()) {
// Running from a checkout
@@ -816,7 +817,7 @@ Fiber(function () {
// Somehow we have a catalog that doesn't have any releases on the
// default track. Try syncing, at least. (This is a pretty unlikely
// error case, since you should always start with a non-empty catalog.)
var refreshFailed = !catalog.refreshOrWarn();
refreshFailed = !catalog.refreshOrWarn();
alreadyRefreshed = true;
releaseName = release.latestKnown();
}
@@ -872,7 +873,7 @@ Fiber(function () {
}
// ATTEMPT 3: modern release, troposphere sync needed.
catalog.refreshOrWarn();
refreshFailed = !catalog.refreshOrWarn();
alreadyRefreshed = true;
// Try to load the release even if the refresh failed, since it might have
@@ -893,9 +894,16 @@ Fiber(function () {
manifest = warehouse.ensureReleaseExistsAndReturnManifest(
releaseName);
} catch (e) {
// XXX handle OfflineError too?
// Note: this is WAREHOUSE's NoSuchReleaseError, not RELEASE's
if (!(e instanceof warehouse.NoSuchReleaseError)) {
if (e instanceof warehouse.NoSuchReleaseError) {
// pass ...
} else if (e instanceof files.OfflineError) {
if (!refreshFailed) {
// Warn if we didn't already warn.
Console.warn("Unable to contact release server (are you offline?)");
}
refreshFailed = true;
} else {
throw e;
}
}
@@ -910,11 +918,20 @@ Fiber(function () {
if (releaseOverride) {
process.stderr.write(releaseName + ": unknown release.\n");
} else if (appDir) {
process.stderr.write(
if (refreshFailed) {
process.stderr.write(
"Problem! This project says that it uses version " + releaseName + " of Meteor,\n" +
"but you don't have that version of Meteor installed, and we were unable to\n" +
"contact Meteor's update servers to find out about it. Please edit the\n" +
".meteor/release file in the project and change it to a valid Meteor release,\n" +
"or go online.\n");
} else {
process.stderr.write(
"Problem! This project says that it uses version " + releaseName + " of Meteor,\n" +
"but you don't have that version of Meteor installed and the Meteor update\n" +
"servers don't have it either. Please edit the .meteor/release file in the\n" +
"project and change it to a valid Meteor release.\n");
}
} else {
throw new Error("can't load latest release?");
}

View File

@@ -69,8 +69,8 @@ selftest.define("springboard", ['checkout', 'net'], function () {
// code for this test. Make sure we get it to pass before merging.
s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
run = s.run("--release", "weird");
run.matchErr("Meteor weird");
run.matchErr("online");
run.matchErr("offline");
run.matchErr("weird: unknown release");
run.expectExit(1);
// Project asking for nonexistent release.
@@ -85,9 +85,9 @@ selftest.define("springboard", ['checkout', 'net'], function () {
// You're offline and project asks for non-cached release.
s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
run = s.run();
run.matchErr("offline");
run.matchErr("Meteor strange");
run.matchErr("not installed");
run.matchErr("online");
run.expectExit(1);
// You create an app from a checkout, and then try to use it from an