Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-2928

Test suite fails & hangs with MONGODB_URI with non-default port

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.6.3
    • Component/s: Testing
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Tested on driver master.

      I ran the test suite with MONGODB_URI referencing a non-default port:

      MONGODB_URI=mongodb://localhost:14400'/?serverSelectionTimeoutMS=1000' npm run check:test
      

      I received the following failures:

        1) Connection
             should correctly start monitoring for single server connection:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ENOENT /tmp/mongodb-27017.sock] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/connection.test.js:22:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        2) Connection
             should correctly connect to server using domain socket:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ENOENT /tmp/mongodb-27017.sock] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/connection.test.js:42:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        3) Connection
             should connect to server using domain socket with undefined port:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ENOENT /tmp/mongodb-27017.sock] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.get (<anonymous>)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/connection.test.js:106:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        4) MongoClient
             should correctly connect to mongodb using domain socket:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ENOENT /tmp/mongodb-27017.sock] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/mongo_client.test.js:126:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        5) Operation Examples
             shouldCorrectlyAddAndRemoveUser:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.get (<anonymous>)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/operation_example.test.js:3536:31
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        6) Operation Examples
             Should correctly connect using MongoClient to a single server using connect:
           Uncaught TypeError: Cannot read property 'db' of undefined
            at /home/w/apps/exp/node-driver/test/functional/operation_example.test.js:5843:25
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        7) Operation (Generators)
             shouldCorrectlyAddAndRemoveUserWithGenerators:
           MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
            at Timeout.<anonymous> (src/sdam/topology.ts:520:30)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        8) Operation (Promises)
             Should correctly connect using MongoClient to a single server using connect With Promises:
           MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
            at Timeout.<anonymous> (src/sdam/topology.ts:520:30)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        9) URI
             should correctly allow for w:0 overriding on the connect url:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.get (<anonymous>)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/uri.test.js:22:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        10) URI
             should correctly connect via domain socket:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ENOENT /tmp/mongodb-27017.sock] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.get (<anonymous>)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/uri.test.js:58:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        11) URI
             should correctly connect via normal url using ip:
           Uncaught TypeError: Cannot read property 'db' of undefined
            at /home/w/apps/exp/node-driver/test/functional/uri.test.js:72:25
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
        12) URI
             should correctly connect using uri encoded username and password:
           Uncaught AssertionError: expected [MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017] to not exist
            at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:828:10)
            at Assertion.propertyGetter (node_modules/chai/lib/chai/utils/addProperty.js:62:29)
            at Object.get (<anonymous>)
            at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:98:22)
            at /home/w/apps/exp/node-driver/test/functional/uri.test.js:90:27
            at /home/w/apps/exp/node-driver/src/utils.ts:635:9
            at /home/w/apps/exp/node-driver/src/mongo_client.ts:331:25
            at connectCallback (src/operations/connect.ts:282:5)
            at /home/w/apps/exp/node-driver/src/operations/connect.ts:403:14
            at Object.callback (src/sdam/topology.ts:353:42)
            at Timeout.<anonymous> (src/sdam/topology.ts:525:25)
            at Timeout.wrapped [as _onTimeout] (node_modules/wtfnode/index.js:197:27)
            at listOnTimeout (internal/timers.js:549:17)
            at processTimers (internal/timers.js:492:7)
      
      

      Some of these are referencing the socket path which perhaps is too much work to make work with non-default ports, but some tests are trying to connect to the default port and these tests in Ruby driver are written to connect to the port provided in the URI.

      The test suite also hung after printing these failures and did not terminate.

      After I aborted the run with Ctrl-C I received the following additional output:

      ^C[WTF Node?] open handles:
      - File descriptors: (note: stdio always exists)
        - fd 1 (tty) (stdio)
        - fd 2 (tty) (stdio)
      - Sockets:
        - 127.0.0.1:48594 -> 127.0.0.1:14400
        - 127.0.0.1:48596 -> 127.0.0.1:14400
        - 127.0.0.1:48790 -> 127.0.0.1:14400
      - Timers:
        - (10000 ~ 10 s) (anonymous) @ /home/w/apps/exp/node-driver/src/sdam/monitor.ts:276
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: