Bug 683396 follow-up: fix test fixtures to avoid test hangs on opt builds. r=me
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Wed, 07 Sep 2011 12:12:46 -0700
changeset 76749 752ab20f2ff82b1066f595a167a81bee94ad7f67
parent 76748 474cf6d733df8b733efe6a4a25f12e544525c5e4
child 76750 cd782e4f3a1bddcacd16113cf4c1336b6f4de382
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersme
bugs683396
milestone9.0a1
Bug 683396 follow-up: fix test fixtures to avoid test hangs on opt builds. r=me
services/sync/tests/unit/test_errorhandler.js
--- a/services/sync/tests/unit/test_errorhandler.js
+++ b/services/sync/tests/unit/test_errorhandler.js
@@ -807,18 +807,20 @@ add_test(function test_meta_global_login
 });
 
 add_test(function test_crypto_keys_login_server_maintenance_error() {
   // Test crypto/keys server maintenance errors are not reported.
   let server = sync_httpd_setup();
   setUp();
 
   Service.clusterURL = "http://localhost:8080/maintenance/";
+  Service.username = "foo";
+  // Force re-download of keys
+  CollectionKeys.clear();
 
-  Service.username = "foo";
   let backoffInterval;
   Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
     Svc.Obs.remove("weave:service:backoff:interval", observe);
     backoffInterval = subject;
   });
 
   function onUIUpdate() {
     do_throw("Shouldn't get here!");
@@ -936,18 +938,20 @@ add_test(function test_meta_global_login
 });
 
 add_test(function test_crypto_keys_login_prolonged_server_maintenance_error(){
   // Test crypto/keys prolonged server maintenance errors are reported.
   let server = sync_httpd_setup();
   setUp();
 
   Service.clusterURL = "http://localhost:8080/maintenance/";
+  Service.username = "foo";
+  // Force re-download of keys
+  CollectionKeys.clear();
 
-  Service.username = "foo";
   let backoffInterval;
   Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
     Svc.Obs.remove("weave:service:backoff:interval", observe);
     backoffInterval = subject;
   });
 
   Svc.Obs.add("weave:ui:login:error", function onUIUpdate() {
     Svc.Obs.remove("weave:ui:login:error", onUIUpdate);
@@ -1062,18 +1066,20 @@ add_test(function test_meta_global_login
 
 add_test(function test_crypto_keys_login_syncAndReportErrors_server_maintenance_error() {
   // Test crypto/keys server maintenance errors are reported
   // when calling syncAndReportErrors.
   let server = sync_httpd_setup();
   setUp();
 
   Service.clusterURL = "http://localhost:8080/maintenance/";
+  Service.username = "foo";
+  // Force re-download of keys
+  CollectionKeys.clear();
 
-  Service.username = "foo";
   let backoffInterval;
   Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
     Svc.Obs.remove("weave:service:backoff:interval", observe);
     backoffInterval = subject;
   });
 
   Svc.Obs.add("weave:ui:login:error", function onUIUpdate() {
     Svc.Obs.remove("weave:ui:login:error", onUIUpdate);
@@ -1188,18 +1194,20 @@ add_test(function test_meta_global_login
 
 add_test(function test_crypto_keys_login_syncAndReportErrors_prolonged_server_maintenance_error() {
   // Test crypto/keys server maintenance errors are reported
   // when calling syncAndReportErrors.
   let server = sync_httpd_setup();
   setUp();
 
   Service.clusterURL = "http://localhost:8080/maintenance/";
+  Service.username = "foo";
+  // Force re-download of keys
+  CollectionKeys.clear();
 
-  Service.username = "foo";
   let backoffInterval;
   Svc.Obs.add("weave:service:backoff:interval", function observe(subject, data) {
     Svc.Obs.remove("weave:service:backoff:interval", observe);
     backoffInterval = subject;
   });
 
   Svc.Obs.add("weave:ui:login:error", function onUIUpdate() {
     Svc.Obs.remove("weave:ui:login:error", onUIUpdate);