mongodb-js / data-service

The MongoDB Data Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate why unit tests are failing on local macOS Sierra

pzrq opened this issue · comments

pzrq@rocket:~/Projects/data-service$ npm test

> mongodb-data-service@2.2.0 pretest /Users/pzrq/Projects/data-service
> mongodb-runner install


> mongodb-data-service@2.2.0 test /Users/pzrq/Projects/data-service
> mocha



  DataService
    #deleteOne
      ✓ deletes the document from the collection (116ms)
    #dropCollection
      ✓ drops a collection (43ms)
    #dropDatabase
      ✓ drops a database (46ms)
    #dropIndex
      ✓ removes an index from a collection (49ms)
    #deleteMany
      ✓ deletes the document from the collection
    #find
      ✓ returns a cursor for the documents
    #findOneAndReplace
      ✓ returns the updated document
    #collection
      ✓ returns the collection details
    #listCollections
      1) returns the collections
    #updateCollection
      ✓ returns the update result
    #count
      when a filter is provided
        ✓ returns a count for the matching documents
    #database
      ✓ returns the database details
    #disconnect
      ✓ disconnects the database
    #createCollection
      2) creates a new collection
    #createIndex
      when options are provided
        ✓ creates a new index with the provided options (80ms)
      when no options are provided
        ✓ creates a new single index (80ms)
        ✓ creates a new compound index (68ms)
    #get
      when the url is /instance
        when passing options
          ✓ returns the instance details
        when passing no options
          ✓ returns the instance details
      when the url is /databases/:database
        when passing options
          ✓ returns the database details
        when passing no options
          ✓ returns the database details
    #instance
      ✓ returns the instance
    #indexes
      ✓ returns the indexes
    #insertOne
      ✓ inserts the document into the collection
    #insertMany
      ✓ inserts the documents into the collection
    #sample
      when no filter is provided
        ✓ returns a stream of sampled documents
    #updateOne
      ✓ updates the document
    #updateMany
      ✓ updates the documents

  NativeClient
    #connect
      when an invalid connection was provided
        ✓ maps the error message
    #new
      ✓ sets the model on the instance
    #find
      when a filter is provided
        ✓ returns a cursor for the matching documents
      when no filter is provided
        ✓ returns a cursor for all documents
      when options are provided
        ✓ returns a cursor for the documents
    #collectionDetail
      ✓ returns the collection details
    #updateCollection
      ✓ returns the update result
    #collectionNames
      ✓ returns the collection names
    #collections
      ✓ returns the collections
    #collectionStats
      ✓ returns an object with the collection stats
    #currentOp
      ✓ returns an object with the currentOp
    #serverStats
      ✓ returns an object with the serverStats
    #top
      ✓ returns an object with the results from top
    #databaseDetail
      ✓ returns the database details
    #databaseStats
      when the user is authorized
        ✓ returns an object with the db stats
      when the user is not authorized
        - passes an error to the callback
    #count
      when a filter is provided
        ✓ returns a count for the matching documents
    #createCollection
      3) creates a new collection
    #createIndex
      when options are provided
        ✓ creates a new index with the provided options (79ms)
      when no options are provided
        ✓ creates a new single index (70ms)
        ✓ creates a new compound index (72ms)
    #explain
      when a filter is provided
        ✓ returns an explain object for the provided filter
    #deleteOne
      ✓ deletes the document from the collection
    #dropCollection
      ✓ drops a collection (45ms)
    #dropDatabase
      ✓ drops a database (43ms)
    #dropIndex
      ✓ removes an index from a collection (40ms)
    #deleteMany
      ✓ deletes the documents from the collection
    #findOneAndReplace
      when no error occurs
        ✓ returns the updated document
      when an error occurs
        ✓ returns the updated document
    #disconnect
      ✓ disconnects the database
    #indexes
      ✓ returns the indexes
    #instance
      ✓ returns the instance
    #insertOne
      ✓ inserts the document into the collection
    #insertMany
      ✓ inserts the documents into the collection
    #sample
      when no filter is provided
        ✓ returns a stream of sampled documents
    INT-1294: Collection name with `.`
      ✓ should return the correct databaseName
      ✓ should return the correct collectionName
    #updateOne
      ✓ updates the document
    #updateMany
      ✓ updates the documents

  Router
    #new
      ✓ initializes the routes
    #resolve
      when the route is /instance
        ✓ returns the instance method
        ✓ returns the instance arguments
      when the route is /deployments
        ✓ returns the deployments method
        ✓ returns the deployments arguments
      when the route is /deployments/:deploymentId
        ✓ returns the deployment method
        ✓ returns the deployment arguments
      when the route is /databases/:database
        ✓ returns the database method
        ✓ returns the database arguments
      when the route is /collections/:ns
        ✓ returns the collection method
        ✓ returns the collection arguments
      when the route is /collections/:ns/count
        ✓ returns the count method
        ✓ returns the count arguments
      when the route is /collections/:ns/find
        ✓ returns the find method
        ✓ returns the find arguments
      when the route is /collections/:ns/explain
        ✓ returns the explain method
        ✓ returns the explain arguments
      when the route is /collections/:ns/aggregate
        ✓ returns the aggregate method
        ✓ returns the aggregate arguments


  82 passing (9s)
  1 pending
  3 failing

  1) DataService #listCollections returns the collections:

      Uncaught AssertionError: expected [ Array(1) ] to deeply equal [ { name: 'test', options: {} } ]
      + expected - actual

       [
         {
      -    "idIndex": {
      -      "key": {
      -        "_id": 1
      -      }
      -      "name": "_id_"
      -      "ns": "data-service.test"
      -      "v": 2
      -    }
      -    "info": {
      -      "readOnly": false
      -    }
           "name": "test"
           "options": {}
      -    "type": "collection"
         }
       ]
      
      at Assertion.assertEqual (node_modules/chai/lib/chai/core/assertions.js:485:19)
      at Assertion.ctx.(anonymous function) [as equal] (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
      at test/data-service.test.js:205:40
      at db.listCollections.toArray (lib/native-client.js:104:7)
      at handleCallback (node_modules/mongodb/lib/utils.js:95:56)
      at node_modules/mongodb/lib/cursor.js:852:16
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at setCursorDeadAndNotified (node_modules/mongodb-core/lib/cursor.js:506:3)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:652:7)
      at CommandCursor.Cursor.next [as _next] (node_modules/mongodb-core/lib/cursor.js:693:3)
      at fetchDocs (node_modules/mongodb/lib/cursor.js:848:10)
      at node_modules/mongodb/lib/cursor.js:871:7
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:683:5)
      at node_modules/mongodb-core/lib/cursor.js:594:7
      at queryCallback (node_modules/mongodb-core/lib/cursor.js:232:18)
      at node_modules/mongodb-core/lib/connection/pool.js:455:18
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)

  2) DataService #createCollection creates a new collection:

      Uncaught AssertionError: expected [ Array(2) ] to deeply equal [ Array(2) ]
      + expected - actual

       [
         {
      -    "idIndex": {
      -      "key": {
      -        "_id": 1
      -      }
      -      "name": "_id_"
      -      "ns": "data-service.foo"
      -      "v": 2
      -    }
      -    "info": {
      -      "readOnly": false
      -    }
           "name": "foo"
           "options": {}
      -    "type": "collection"
         }
         {
      -    "idIndex": {
      -      "key": {
      -        "_id": 1
      -      }
      -      "name": "_id_"
      -      "ns": "data-service.test"
      -      "v": 2
      -    }
      -    "info": {
      -      "readOnly": false
      -    }
           "name": "test"
           "options": {}
      -    "type": "collection"
         }
       ]
      
      at Assertion.assertEqual (node_modules/chai/lib/chai/core/assertions.js:485:19)
      at Assertion.ctx.(anonymous function) [as equal] (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
      at test/data-service.test.js:274:33
      at handleCallback (node_modules/mongodb/lib/utils.js:95:56)
      at node_modules/mongodb/lib/cursor.js:852:16
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at setCursorDeadAndNotified (node_modules/mongodb-core/lib/cursor.js:506:3)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:652:7)
      at CommandCursor.Cursor.next [as _next] (node_modules/mongodb-core/lib/cursor.js:693:3)
      at fetchDocs (node_modules/mongodb/lib/cursor.js:848:10)
      at node_modules/mongodb/lib/cursor.js:871:7
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:683:5)
      at node_modules/mongodb-core/lib/cursor.js:594:7
      at queryCallback (node_modules/mongodb-core/lib/cursor.js:232:18)
      at node_modules/mongodb-core/lib/connection/pool.js:455:18
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)

  3) NativeClient #createCollection creates a new collection:

      Uncaught AssertionError: expected [ Array(2) ] to deeply equal [ Array(2) ]
      + expected - actual

       [
         {
      -    "idIndex": {
      -      "key": {
      -        "_id": 1
      -      }
      -      "name": "_id_"
      -      "ns": "data-service.foo"
      -      "v": 2
      -    }
      -    "info": {
      -      "readOnly": false
      -    }
           "name": "foo"
           "options": {}
      -    "type": "collection"
         }
         {
      -    "idIndex": {
      -      "key": {
      -        "_id": 1
      -      }
      -      "name": "_id_"
      -      "ns": "data-service.test"
      -      "v": 2
      -    }
      -    "info": {
      -      "readOnly": false
      -    }
           "name": "test"
           "options": {}
      -    "type": "collection"
         }
       ]
      
      at Assertion.assertEqual (node_modules/chai/lib/chai/core/assertions.js:485:19)
      at Assertion.ctx.(anonymous function) [as equal] (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
      at test/native-client.test.js:236:33
      at handleCallback (node_modules/mongodb/lib/utils.js:95:56)
      at node_modules/mongodb/lib/cursor.js:852:16
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at setCursorDeadAndNotified (node_modules/mongodb-core/lib/cursor.js:506:3)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:652:7)
      at CommandCursor.Cursor.next [as _next] (node_modules/mongodb-core/lib/cursor.js:693:3)
      at fetchDocs (node_modules/mongodb/lib/cursor.js:848:10)
      at node_modules/mongodb/lib/cursor.js:871:7
      at handleCallback (node_modules/mongodb-core/lib/cursor.js:171:5)
      at nextFunction (node_modules/mongodb-core/lib/cursor.js:683:5)
      at node_modules/mongodb-core/lib/cursor.js:594:7
      at queryCallback (node_modules/mongodb-core/lib/cursor.js:232:18)
      at node_modules/mongodb-core/lib/connection/pool.js:455:18
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)



npm ERR! Test failed.  See above for more details.
  • Investigate if it happens on Ubuntu VM as well

Thanks @aherlihy

Confirmed on macOS Sierra and Ubuntu 14.04 that 89879f3 resolves the test failures.