From 699518146aa818e3381bd2aa3070417e9c19ec73 Mon Sep 17 00:00:00 2001 From: James Nylen Date: Tue, 6 Jan 2015 11:07:42 -0600 Subject: [PATCH] Always wait for server.close() callback in tests Somehow I missed a whole bunch of these in #1327. --- tests/test-agentOptions.js | 5 +++-- tests/test-basic-auth.js | 5 +++-- tests/test-bearer-auth.js | 5 +++-- tests/test-body.js | 5 +++-- tests/test-defaults.js | 5 +++-- tests/test-digest-auth.js | 5 +++-- tests/test-emptyBody.js | 5 +++-- tests/test-event-forwarding.js | 5 +++-- tests/test-headers.js | 5 +++-- tests/test-https.js | 5 +++-- tests/test-isUrl.js | 5 +++-- tests/test-json-request.js | 5 +++-- tests/test-node-debug.js | 5 +++-- tests/test-option-reuse.js | 5 +++-- tests/test-params.js | 5 +++-- tests/test-piped-redirect.js | 8 +++++--- tests/test-pipes.js | 5 +++-- tests/test-pool.js | 5 +++-- tests/test-proxy-connect.js | 5 +++-- tests/test-proxy.js | 5 +++-- tests/test-redirect-auth.js | 8 +++++--- tests/test-redirect-complex.js | 8 +++++--- tests/test-redirect.js | 8 +++++--- tests/test-timeout.js | 5 +++-- tests/test-toJSON.js | 5 +++-- tests/test-unix.js | 8 +++++--- 26 files changed, 88 insertions(+), 57 deletions(-) diff --git a/tests/test-agentOptions.js b/tests/test-agentOptions.js index 1294235d3..665e7408c 100644 --- a/tests/test-agentOptions.js +++ b/tests/test-agentOptions.js @@ -41,6 +41,7 @@ tape('with agentOptions should apply to new agent in pool', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-basic-auth.js b/tests/test-basic-auth.js index 69d90798b..62b5f8be4 100644 --- a/tests/test-basic-auth.js +++ b/tests/test-basic-auth.js @@ -179,6 +179,7 @@ tape('', function(t) { }) tape('cleanup', function(t) { - basicServer.close() - t.end() + basicServer.close(function() { + t.end() + }) }) diff --git a/tests/test-bearer-auth.js b/tests/test-bearer-auth.js index 998398b41..38c41f126 100644 --- a/tests/test-bearer-auth.js +++ b/tests/test-bearer-auth.js @@ -148,6 +148,7 @@ tape('', function(t) { }) tape('cleanup', function(t) { - bearerServer.close() - t.end() + bearerServer.close(function() { + t.end() + }) }) diff --git a/tests/test-body.js b/tests/test-body.js index 9f1794361..d605f574f 100644 --- a/tests/test-body.js +++ b/tests/test-body.js @@ -145,6 +145,7 @@ addTest('testPutMultipartPostambleCRLF', { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-defaults.js b/tests/test-defaults.js index fe371fc44..ec827be68 100644 --- a/tests/test-defaults.js +++ b/tests/test-defaults.js @@ -254,6 +254,7 @@ tape('test only setting undefined properties', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-digest-auth.js b/tests/test-digest-auth.js index 07461d1c3..5ea141ee5 100644 --- a/tests/test-digest-auth.js +++ b/tests/test-digest-auth.js @@ -157,6 +157,7 @@ tape('with different credentials', function(t) { }) tape('cleanup', function(t) { - digestServer.close() - t.end() + digestServer.close(function() { + t.end() + }) }) diff --git a/tests/test-emptyBody.js b/tests/test-emptyBody.js index 86bc6c0e9..0e4acc55f 100644 --- a/tests/test-emptyBody.js +++ b/tests/test-emptyBody.js @@ -49,6 +49,7 @@ tape('empty JSON body', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-event-forwarding.js b/tests/test-event-forwarding.js index e2f800e34..ebaad4c0d 100644 --- a/tests/test-event-forwarding.js +++ b/tests/test-event-forwarding.js @@ -33,6 +33,7 @@ tape('should emit socket event', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-headers.js b/tests/test-headers.js index 2b265a6a8..773cf863d 100644 --- a/tests/test-headers.js +++ b/tests/test-headers.js @@ -130,6 +130,7 @@ tape('upper-case Host header and redirect', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-https.js b/tests/test-https.js index ed1da0320..04b1aa423 100644 --- a/tests/test-https.js +++ b/tests/test-https.js @@ -109,8 +109,9 @@ function runAllTests(strict, s) { }) tape(strictMsg + 'cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) } diff --git a/tests/test-isUrl.js b/tests/test-isUrl.js index 8a218601f..c6b930ddc 100644 --- a/tests/test-isUrl.js +++ b/tests/test-isUrl.js @@ -95,6 +95,7 @@ tape('hostname and port 3', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-json-request.js b/tests/test-json-request.js index 08a963a68..a1d6f32bd 100644 --- a/tests/test-json-request.js +++ b/tests/test-json-request.js @@ -74,6 +74,7 @@ testJSONValueReviver('jsonReviver', -48269.592, function (k, v) { testJSONValueReviver('jsonReviverInvalid', -48269.592, 'invalid reviver', -48269.592) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-node-debug.js b/tests/test-node-debug.js index c9f7b9d31..9d5a0f6fd 100644 --- a/tests/test-node-debug.js +++ b/tests/test-node-debug.js @@ -79,6 +79,7 @@ tape('it should be possible to disable debugging at runtime', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-option-reuse.js b/tests/test-option-reuse.js index ddf8ca3df..c2dcf63c6 100644 --- a/tests/test-option-reuse.js +++ b/tests/test-option-reuse.js @@ -47,6 +47,7 @@ tape('options object is not mutated', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-params.js b/tests/test-params.js index 8e7929649..be19f7be7 100644 --- a/tests/test-params.js +++ b/tests/test-params.js @@ -96,6 +96,7 @@ runTest('testPutMultipart', { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-piped-redirect.js b/tests/test-piped-redirect.js index d634ab2a0..972678abb 100644 --- a/tests/test-piped-redirect.js +++ b/tests/test-piped-redirect.js @@ -45,7 +45,9 @@ tape('piped redirect', function(t) { }) tape('cleanup', function(t) { - s1.close() - s2.close() - t.end() + s1.close(function() { + s2.close(function() { + t.end() + }) + }) }) diff --git a/tests/test-pipes.js b/tests/test-pipes.js index 22b7eee4d..fb44980c7 100644 --- a/tests/test-pipes.js +++ b/tests/test-pipes.js @@ -275,6 +275,7 @@ tape('request.pipefilter is called correctly', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-pool.js b/tests/test-pool.js index 7d996a31a..417870369 100644 --- a/tests/test-pool.js +++ b/tests/test-pool.js @@ -31,6 +31,7 @@ tape('pool', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-proxy-connect.js b/tests/test-proxy-connect.js index e7667656a..cc3596874 100644 --- a/tests/test-proxy-connect.js +++ b/tests/test-proxy-connect.js @@ -77,6 +77,7 @@ tape('proxy', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-proxy.js b/tests/test-proxy.js index 12c5f9666..70354797f 100644 --- a/tests/test-proxy.js +++ b/tests/test-proxy.js @@ -238,6 +238,7 @@ if (process.env.TEST_PROXY_HARNESS) { tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-redirect-auth.js b/tests/test-redirect-auth.js index 8ef0409e1..510604dbc 100644 --- a/tests/test-redirect-auth.js +++ b/tests/test-redirect-auth.js @@ -118,7 +118,9 @@ runTest('different host and protocol', false) tape('cleanup', function(t) { - s.close() - ss.close() - t.end() + s.close(function() { + ss.close(function() { + t.end() + }) + }) }) diff --git a/tests/test-redirect-complex.js b/tests/test-redirect-complex.js index 88b3d2e87..d99b962e1 100644 --- a/tests/test-redirect-complex.js +++ b/tests/test-redirect-complex.js @@ -79,7 +79,9 @@ tape('lots of redirects', function(t) { }) tape('cleanup', function(t) { - s.close() - ss.close() - t.end() + s.close(function() { + ss.close(function() { + t.end() + }) + }) }) diff --git a/tests/test-redirect.js b/tests/test-redirect.js index d7f75243a..d8301fb60 100644 --- a/tests/test-redirect.js +++ b/tests/test-redirect.js @@ -313,7 +313,9 @@ tape('http to https redirect', function(t) { }) tape('cleanup', function(t) { - s.close() - ss.close() - t.end() + s.close(function() { + ss.close(function() { + t.end() + }) + }) }) diff --git a/tests/test-timeout.js b/tests/test-timeout.js index 2e59a6c85..a270ef1ed 100644 --- a/tests/test-timeout.js +++ b/tests/test-timeout.js @@ -112,7 +112,8 @@ if (process.env.TRAVIS === 'true') { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) } diff --git a/tests/test-toJSON.js b/tests/test-toJSON.js index e8d9fbf47..cc983d75e 100644 --- a/tests/test-toJSON.js +++ b/tests/test-toJSON.js @@ -38,6 +38,7 @@ tape('request().toJSON()', function(t) { }) tape('cleanup', function(t) { - s.close() - t.end() + s.close(function() { + t.end() + }) }) diff --git a/tests/test-unix.js b/tests/test-unix.js index cfd3751c3..16a2cc85d 100644 --- a/tests/test-unix.js +++ b/tests/test-unix.js @@ -36,7 +36,9 @@ tape('unix socket connection', function(t) { }) tape('cleanup', function(t) { - s.close() - fs.unlink(socket, function() { }) - t.end() + s.close(function() { + fs.unlink(socket, function() { + t.end() + }) + }) })