Skip to content

Commit

Permalink
Always wait for server.close() callback in tests
Browse files Browse the repository at this point in the history
Somehow I missed a whole bunch of these in request#1327.
  • Loading branch information
nylen committed Jan 6, 2015
1 parent 3786137 commit 6995181
Show file tree
Hide file tree
Showing 26 changed files with 88 additions and 57 deletions.
5 changes: 3 additions & 2 deletions tests/test-agentOptions.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-basic-auth.js
Expand Up @@ -179,6 +179,7 @@ tape('', function(t) {
})

tape('cleanup', function(t) {
basicServer.close()
t.end()
basicServer.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-bearer-auth.js
Expand Up @@ -148,6 +148,7 @@ tape('', function(t) {
})

tape('cleanup', function(t) {
bearerServer.close()
t.end()
bearerServer.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-body.js
Expand Up @@ -145,6 +145,7 @@ addTest('testPutMultipartPostambleCRLF', {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-defaults.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-digest-auth.js
Expand Up @@ -157,6 +157,7 @@ tape('with different credentials', function(t) {
})

tape('cleanup', function(t) {
digestServer.close()
t.end()
digestServer.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-emptyBody.js
Expand Up @@ -49,6 +49,7 @@ tape('empty JSON body', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-event-forwarding.js
Expand Up @@ -33,6 +33,7 @@ tape('should emit socket event', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-headers.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-https.js
Expand Up @@ -109,8 +109,9 @@ function runAllTests(strict, s) {
})

tape(strictMsg + 'cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
}

Expand Down
5 changes: 3 additions & 2 deletions tests/test-isUrl.js
Expand Up @@ -95,6 +95,7 @@ tape('hostname and port 3', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-json-request.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-node-debug.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-option-reuse.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-params.js
Expand Up @@ -96,6 +96,7 @@ runTest('testPutMultipart', {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
8 changes: 5 additions & 3 deletions tests/test-piped-redirect.js
Expand Up @@ -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()
})
})
})
5 changes: 3 additions & 2 deletions tests/test-pipes.js
Expand Up @@ -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()
})
})
5 changes: 3 additions & 2 deletions tests/test-pool.js
Expand Up @@ -31,6 +31,7 @@ tape('pool', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-proxy-connect.js
Expand Up @@ -77,6 +77,7 @@ tape('proxy', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
5 changes: 3 additions & 2 deletions tests/test-proxy.js
Expand Up @@ -238,6 +238,7 @@ if (process.env.TEST_PROXY_HARNESS) {


tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
8 changes: 5 additions & 3 deletions tests/test-redirect-auth.js
Expand Up @@ -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()
})
})
})
8 changes: 5 additions & 3 deletions tests/test-redirect-complex.js
Expand Up @@ -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()
})
})
})
8 changes: 5 additions & 3 deletions tests/test-redirect.js
Expand Up @@ -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()
})
})
})
5 changes: 3 additions & 2 deletions tests/test-timeout.js
Expand Up @@ -112,7 +112,8 @@ if (process.env.TRAVIS === 'true') {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
}
5 changes: 3 additions & 2 deletions tests/test-toJSON.js
Expand Up @@ -38,6 +38,7 @@ tape('request().toJSON()', function(t) {
})

tape('cleanup', function(t) {
s.close()
t.end()
s.close(function() {
t.end()
})
})
8 changes: 5 additions & 3 deletions tests/test-unix.js
Expand Up @@ -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()
})
})
})

0 comments on commit 6995181

Please sign in to comment.