Remove 'random' pauses in HCP tests; insert the one which works

Still better to fix this properly, but this gives us a single starting point
This commit is contained in:
Justin SB
2014-10-04 17:16:03 -07:00
parent abc12875b1
commit 5e2cb2bfc5

View File

@@ -6,11 +6,6 @@ var net = require('net');
var _ = require('underscore');
var files = require('../files.js');
// XXX: Remove me. This shouldn't be neeeded, but sometimes
// if we run too quickly on fast (or Linux?) machines, we get
// 'stuck'
HACK_DELAY = 3;
selftest.define("css hot code push", function (options) {
var s = new Sandbox({
clients: options.clients
@@ -79,7 +74,6 @@ selftest.define("css hot code push", function (options) {
run.match("numCssChanges: 1");
run.match(/background-color: (red|rgb\(255, 0, 0\))/);
run.waitSecs(HACK_DELAY);
s.write(".meteor/packages", "standard-app-packages");
run.match("removed my-package");
run.match("numCssChanges: 0");
@@ -138,14 +132,12 @@ selftest.define("javascript hot code push", function (options) {
// The server and client both restart if a shared js file is added
// or removed.
run.waitSecs(HACK_DELAY);
s.write("test.js", "jsVar = 'foo'");
run.match("server restarted");
run.match("client connected: 0");
run.match("jsVar: foo");
run.match("sessionVar: true");
run.waitSecs(HACK_DELAY);
s.unlink("test.js");
run.match("server restarted");
run.match("client connected: 0");
@@ -154,14 +146,12 @@ selftest.define("javascript hot code push", function (options) {
// Only the client should refresh if a client js file is added. Thus,
// "client connected" variable will be incremented.
run.waitSecs(HACK_DELAY);
s.mkdir("client");
s.write("client/test.js", "jsVar = 'bar'");
run.match("client connected: 1");
run.match("jsVar: bar");
run.waitSecs(HACK_DELAY);
s.unlink("client/test.js");
run.match("client connected: 2");
run.match("jsVar: undefined");
@@ -169,18 +159,15 @@ selftest.define("javascript hot code push", function (options) {
// When we change a server file the client should not refresh. We observe
// this by changing a server file and then a client file and verifying
// that the client has only connected once.
run.waitSecs(HACK_DELAY);
s.mkdir("server");
s.write("server/test.js", "jsVar = 'bar'");
run.match("server restarted");
run.waitSecs(HACK_DELAY);
s.write("client/empty.js", "");
run.match("client connected: 0");
// We should not be able to access a server variable from the client.
run.match("jsVar: undefined");
run.waitSecs(HACK_DELAY);
s.unlink("client/empty.js");
run.waitSecs(5);
run.match("client connected: 1");
@@ -191,23 +178,19 @@ selftest.define("javascript hot code push", function (options) {
// it only affects the client. But this is a regression test for a bug where
// fixing the HTML file wouldn't actually restart the server; that's the
// important part of this test.)
run.waitSecs(HACK_DELAY);
s.write("hot-code-push-test.html", ">");
run.match("Errors prevented startup");
run.match("bad formatting in HTML template");
// Fix it. It should notice, and restart. The client will restart too.
run.waitSecs(HACK_DELAY);
s.write("hot-code-push-test.html", "");
run.match("server restarted");
run.match("client connected: 0");
// Write something else to it. The client should restart.
run.waitSecs(HACK_DELAY);
s.write("hot-code-push-test.html", "<head><title>foo</title></head>");
run.match("Client modified -- refreshing");
run.match("client connected: 1");
run.match("jsVar: undefined");
run.waitSecs(HACK_DELAY);
s.write(".meteor/packages", "standard-app-packages \n my-package");
run.match("added my-package");
run.match("server restarted");
@@ -215,33 +198,33 @@ selftest.define("javascript hot code push", function (options) {
run.match("jsVar: undefined");
run.match("packageVar: foo");
run.waitSecs(HACK_DELAY);
s.write("packages/my-package/foo.js", "packageVar = 'bar'");
run.match("client connected: 1");
run.match("jsVar: undefined");
run.match("packageVar: bar");
// Add appcache and ensure that the browser still reloads.
run.waitSecs(HACK_DELAY);
s.write(".meteor/packages", "standard-app-packages \n appcache");
run.match("added appcache");
run.match("server restarted");
run.match("client connected: 0");
run.match("jsVar: undefined");
run.waitSecs(HACK_DELAY);
// XXX: Remove me. This shouldn't be needed, but sometimes
// if we run too quickly on fast (or Linux?) machines, it looks
// like there's a race and we see a weird state
utils.sleepMs(10000);
s.write("client/test.js", "jsVar = 'bar'");
run.match("client connected: 1");
run.match("jsVar: bar");
// Remove appcache and ensure that the browser still reloads.
run.waitSecs(HACK_DELAY);
s.write(".meteor/packages", "standard-app-packages");
run.match("removed appcache");
run.match("server restarted");
run.match("client connected: 0");
run.waitSecs(HACK_DELAY);
s.write("client/test.js", "jsVar = 'baz'");
run.match("client connected: 1");
run.match("jsVar: baz");
@@ -250,14 +233,12 @@ selftest.define("javascript hot code push", function (options) {
// Setting the autoupdateVersion to a different string should also
// force the client to restart.
run.waitSecs(HACK_DELAY);
s.write("server/test.js",
"Package.autoupdate.Autoupdate.autoupdateVersion = 'random'");
run.match("server restarted");
run.match("client connected: 0");
run.match("jsVar: undefined");
run.waitSecs(HACK_DELAY);
s.unlink("server/test.js");
run.match("server restarted");