Bug 1355207 - Wait for http server shutdown and disable test_host.js on OSX. r=dragana, a=test-only
authorValentin Gosu <valentin.gosu@gmail.com>
Tue, 18 Dec 2018 11:14:14 +0000
changeset 509068 df270c166d44b24581befe5128f650832296381e
parent 509067 1e8a7d7842cbc04c4b8fa3c408e01a5f7e815d76
child 509069 46828493249a63eccefa3ec6bbe4c0c94df4d650
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana, test-only
bugs1355207
milestone65.0
Bug 1355207 - Wait for http server shutdown and disable test_host.js on OSX. r=dragana, a=test-only The test intermittently fails on OSX. For some reason start(PORT) doesn't always fail when PORT is in use, so we timeout because the handler is never called. I suspect it's because of how SO_REUSEADDR and SO_REUSEPORT are handled on sockets sever-side on OSX. Since httpd is used for unit tests, there is little risk in disabling the test on OSX. The alternative is to check for a timeout, and in that case switch to another port - which is cumbersome, and not the purpose of the test. Differential Revision: https://phabricator.services.mozilla.com/D14756
netwerk/test/httpserver/test/test_host.js
netwerk/test/httpserver/test/xpcshell.ini
--- a/netwerk/test/httpserver/test/test_host.js
+++ b/netwerk/test/httpserver/test/test_host.js
@@ -175,17 +175,20 @@ add_task(async function run_test_3() {
   Assert.ok(!id.has("http", "localhost", FAKE_PORT_ONE));
   Assert.ok(!id.has("http", "127.0.0.1", FAKE_PORT_ONE));
   Assert.ok(!id.has("http", "example.com", FAKE_PORT_TWO));
   Assert.ok(!id.has("http", "localhost", FAKE_PORT_TWO));
   Assert.ok(!id.has("http", "127.0.0.1", FAKE_PORT_TWO));
 
   // Okay, finally done with identity testing.  Our primary location is the one
   // we want it to be, so we're off!
-  runRawTests(tests, () => { srv.stop(); }, (idx) => dump(`running test no ${idx}`));
+  await new Promise(resolve => runRawTests(tests, resolve, (idx) => dump(`running test no ${idx}`)));
+
+  // Finally shut down the server.
+  await new Promise(resolve => srv.stop(resolve));
 });
 
 
 /** *******************
  * UTILITY FUNCTIONS *
  *********************/
 
 /**
--- a/netwerk/test/httpserver/test/xpcshell.ini
+++ b/netwerk/test/httpserver/test/xpcshell.ini
@@ -8,17 +8,17 @@ support-files = data/** ../httpd.js
 [test_byte_range.js]
 [test_cern_meta.js]
 [test_default_index_handler.js]
 [test_empty_body.js]
 [test_errorhandler_exception.js]
 [test_header_array.js]
 [test_headers.js]
 [test_host.js]
-skip-if = (verify && debug && (os == 'mac'))
+skip-if = os == 'mac'
 run-sequentially = Reusing same server on different specific ports.
 [test_linedata.js]
 [test_load_module.js]
 [test_name_scheme.js]
 [test_processasync.js]
 [test_qi.js]
 [test_registerdirectory.js]
 [test_registerfile.js]