Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures on macOS w/ node v17 #393

Closed
joeyparrish opened this issue Mar 21, 2022 · 1 comment · Fixed by #394
Closed

Test failures on macOS w/ node v17 #393

joeyparrish opened this issue Mar 21, 2022 · 1 comment · Fixed by #394

Comments

@joeyparrish
Copy link
Contributor

I get the following test failures on macOS.

These two because of a bad URL, and should fail on all platforms. They rely on http://www.nina.jp/server/slackware/webapp/tomcat_charset.html , but this no longer exists. I believe this should be replaced by a local server.

  1) character encoding
       Given content-type: "text/html; charset=EUC-JP"
         with decode = false
           does not decode:
     Uncaught TypeError: Cannot read properties of undefined (reading 'body')
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/decoder_spec.js:24:16
      at done (lib/needle.js:501:14)
      at ClientRequest.had_error (lib/needle.js:516:5)
      at ClientRequest.emit (node:events:526:28)
      at Socket.socketErrorListener (node:_http_client:442:9)
      at Socket.emit (node:events:526:28)
      at emitErrorNT (node:internal/streams/destroy:164:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

  2) character encoding
       Given content-type: "text/html; charset=EUC-JP"
         with decode = true
           decodes:
     Uncaught TypeError: Cannot read properties of undefined (reading 'body')
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/decoder_spec.js:39:16
      at done (lib/needle.js:501:14)
      at ClientRequest.had_error (lib/needle.js:516:5)
      at ClientRequest.emit (node:events:526:28)
      at Socket.socketErrorListener (node:_http_client:442:9)
      at Socket.emit (node:events:526:28)
      at emitErrorNT (node:internal/streams/destroy:164:8)
      at emitErrorCloseNT (node:internal/streams/destroy:129:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

These fail if run on macOS because they only exclude Windows, and /proc/self/fd isn't available on Mac, either. I believe that these should only run on Linux.

  3) with output option
       and a 200 response
         for an empty response
           closes the file descriptor:
     Error: ENOENT: no such file or directory, scandir '/proc/self/fd'
      at Object.readdirSync (node:fs:1392:3)
      at get_open_file_descriptors (test/output_spec.js:27:19)
      at Context.<anonymous> (test/output_spec.js:114:34)
      at processImmediate (node:internal/timers:466:21)

  4) with output option
       and a 200 response
         for a JSON response
           closes the file descriptor:
     Error: ENOENT: no such file or directory, scandir '/proc/self/fd'
      at Object.readdirSync (node:fs:1392:3)
      at get_open_file_descriptors (test/output_spec.js:27:19)
      at Context.<anonymous> (test/output_spec.js:171:32)
      at processImmediate (node:internal/timers:466:21)

  5) with output option
       and a 200 response
         for a binary file
           closes the file descriptor:
     Error: ENOENT: no such file or directory, scandir '/proc/self/fd'
      at Object.readdirSync (node:fs:1392:3)
      at get_open_file_descriptors (test/output_spec.js:27:19)
      at Context.<anonymous> (test/output_spec.js:241:34)
      at processImmediate (node:internal/timers:466:21)

These tests seem to be testing some behavior of node's HTTP server, not the client. The client doesn't control if the server returns 400 (expected on node >= 10), or ECONNRESET (expected on other versions), and therefore fails if the server behaves differently than expected (returns 200 for me). Since the only expectations are set on a component outside this project, I believe this is just a bad test that should be deleted.

  6) request stream length
       no stream_length set
         returns 400 if Transfer-Encoding is set to a blank string:

      Uncaught AssertionError: expected 200 to equal 400
      + expected - actual

      -200
      +400
      
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/request_stream_spec.js:66:34
      at done (lib/needle.js:501:14)
      at PassThrough.<anonymous> (lib/needle.js:764:9)
      at PassThrough.emit (node:events:538:35)
      at endReadableNT (node:internal/streams/readable:1342:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

  7) request stream length
       stream_length set to invalid value
         returns 400 if Transfer-Encoding is set to a blank string:

      Uncaught AssertionError: expected 200 to equal 400
      + expected - actual

      -200
      +400
      
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/request_stream_spec.js:96:34
      at done (lib/needle.js:501:14)
      at PassThrough.<anonymous> (lib/needle.js:764:9)
      at PassThrough.emit (node:events:538:35)
      at endReadableNT (node:internal/streams/readable:1342:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

  8) request stream length
       stream_length set to invalid value
         returns 400 if Transfer-Encoding is not set:

      Uncaught AssertionError: expected 200 to equal 400
      + expected - actual

      -200
      +400
      
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/request_stream_spec.js:104:34
      at done (lib/needle.js:501:14)
      at PassThrough.<anonymous> (lib/needle.js:764:9)
      at PassThrough.emit (node:events:538:35)
      at endReadableNT (node:internal/streams/readable:1342:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

  9) request stream length
       stream_length set to 0
         stream without path
           returns 400 if Transfer-Encoding is set to a blank string:

      Uncaught AssertionError: expected 200 to equal 400
      + expected - actual

      -200
      +400
      
      at Assertion.fail (node_modules/should/cjs/should.js:275:17)
      at Assertion.value (node_modules/should/cjs/should.js:356:19)
      at /Users/alcatrazqa/joey/shaka-player/node_modules/needle/test/request_stream_spec.js:213:36
      at done (lib/needle.js:501:14)
      at PassThrough.<anonymous> (lib/needle.js:764:9)
      at PassThrough.emit (node:events:538:35)
      at endReadableNT (node:internal/streams/readable:1342:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)
joeyparrish added a commit to joeyparrish/needle that referenced this issue Mar 21, 2022
 - Fix decoder test failures by importing the necessary data and running
   a local server, rather than relying on external sites
 - Tests depending on /proc are now only run on Linux
 - Tests that only set expectations on the behavior of the node http
   server (rather than needle itself) have been deleted

Closes tomas#393
@joeyparrish
Copy link
Contributor Author

I should have mentioned, these failures were all on node v17.

@joeyparrish joeyparrish changed the title Test failures on macOS Test failures on macOS w/ node v17 Mar 22, 2022
joeyparrish added a commit to joeyparrish/needle that referenced this issue Mar 22, 2022
 - Fix decoder test failures by importing the necessary data and running
   a local server, rather than relying on external sites
 - Tests depending on /proc are now only run on Linux
 - Tests that only set expectations on the behavior of the node http
   server (rather than needle itself) have been deleted

Closes tomas#393
joeyparrish added a commit to joeyparrish/needle that referenced this issue Mar 22, 2022
 - Fix decoder test failures by importing the necessary data and running
   a local server, rather than relying on external sites
 - Tests depending on /proc are now only run on Linux
 - Tests that only set expectations on the behavior of the node http
   server (rather than needle itself) have been deleted

Closes tomas#393
joeyparrish added a commit to joeyparrish/needle that referenced this issue Mar 22, 2022
 - Fix decoder test failures by importing the necessary data and running
   a local server, rather than relying on external sites
 - Tests depending on /proc are now only run on Linux
 - Tests that only set expectations on the behavior of the node http
   server (rather than needle itself) have been deleted

Closes tomas#393
@tomas tomas closed this as completed in #394 Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant