mafintosh / torrent-stream

The low level streaming torrent engine that peerflix uses
MIT License
1.94k stars 228 forks source link

failed tests in node 0.12 #110

Closed nickdesaulniers closed 9 years ago

nickdesaulniers commented 9 years ago
git clone https://github.com/mafintosh/torrent-stream.git
cd torrent-stream
npm i
npm t

prints:

> torrent-stream@0.18.1 test /Users/Nicholas/code/node/torrent-stream
> tap test/*.js

ok test/auto-block.js ................................... 8/8
not ok test/basic.js .................................... 0/1
    Command: "/Users/Nicholas/.nvm/versions/node/v0.12.0/bin/node basic.js"
    TAP version 13
    not ok 1 test/basic.js
      ---
        exit:     ~
        timedOut: true
        signal:   SIGTERM
        command:  "/Users/Nicholas/.nvm/versions/node/v0.12.0/bin/node basic.js"
      ...

    1..1
    # tests 1
    # fail  1

ok test/blocklist.js .................................. 12/12
not ok test/storage.js ................................ 19/21
    Command: "/Users/Nicholas/.nvm/versions/node/v0.12.0/bin/node storage.js"
    TAP version 13
    ok 1 should be ready
    ok 2 should verify all the pieces
    ok 3 should have one file
    ok 4 should be equal
    ok 5 should be equal
    not ok 6 should be equal
      ---
        file:   /Users/Nicholas/code/node/torrent-stream/test/storage.js
        line:   38
        column: 6
        stack:
          - |
            getCaller (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:418:17)
          - |
            assert (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:21:16)
          - |
            Function.equal (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:162:10)
          - |
            Test._testAssert [as equal] (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-test.js:87:16)
          - |
            null.<anonymous> (/Users/Nicholas/code/node/torrent-stream/test/storage.js:38:6)
          - |
            emit (events.js:104:17)
          - |
            emitReadable_ (_stream_readable.js:424:10)
          - |
            emitReadable (_stream_readable.js:418:7)
          - |
            onEofChunk (_stream_readable.js:401:3)
          - |
            readableAddChunk (_stream_readable.js:146:7)
        found:  ~
        wanted: amet.
        type:
          found:  undefined
          wanted: undefined
      ...
    not ok 7 test count != plan
      ---
        file:   node.js
        line:   355
        column: 11
        stack:
          - |
            getCaller (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:418:17)
          - |
            assert (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:21:16)
          - |
            Function.equal (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-assert.js:162:10)
          - |
            Test.Harness.end (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-harness.js:117:31)
          - |
            Test._endNice (/Users/Nicholas/code/node/torrent-stream/node_modules/tap/lib/tap-test.js:70:26)
          - |
            process._tickCallback (node.js:355:11)
        found:  2
        wanted: 1
      ...
    ok 8 should be equal
    ok 9 should be equal
    ok 10 should be equal
    ok 11 should be equal
    ok 12 should be equal
    ok 13 should be equal
    ok 14 should be equal
    ok 15 should be equal
    ok 16 should be equal
    ok 17 should be equal
    ok 18 should be equal
    ok 19 should be equal
    ok 20 should be destroyed
    ok 21 test/storage.js

    1..21
    # tests 21
    # pass  19
    # fail  2

ok test/tracker.js .................................... 23/23
total ................................................. 62/65

not ok
npm ERR! Test failed.  See above for more details.
nickdesaulniers commented 9 years ago

In node 0.10.26, only test/basic.js fails. Same time out. Nothing else running on port 10000.

nickdesaulniers commented 9 years ago

yet if I simply run node test/basic.js, the individual test pass. I wonder if we're not cleaning up soon enough and reusing the same ports?

nickdesaulniers commented 9 years ago

For test/storage.js, it seems that file.createReadStream({ start: 36109 }).on('readable', cb) fires twice, with the first time being correct, the second time stream.read(6) is null. Curious as to why onreadable is firing twice in Node 0.12?