bluehalo / bluehalo/node-rest-starter

Team Service Spec Failure

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
13
Forks
10
PR merge metrics
No merged PRs in 30d

Description

The teams.service.spec.js is encountering periodic failures on line 341 in the test 'should delete team, if team has no resources' .

The userTeam variable that should not exist is sometimes found as :

AssertionError: expected EmbeddedDocument {
  __parentArray: CoreDocumentArray [ [Circular] ],
  __index: 0,
  $isDocumentArrayElement: true,
  $__: InternalCache {
    strictMode: true,
    selected: undefined,
    shardval: undefined,
    saveError: undefined,
    validationError: undefined,
    adhocPaths: undefined,
    removing: undefined,
    inserting: undefined,
    saving: undefined,
    version: undefined,
    getters: Object {},
    _id: ObjectID {
      _bsontype: 'ObjectID',
      id: Buffer [ 60, 40, ee, 45, 59, 9d, 65, bb, f0, 9f, 94, 0d ]
    },
    populate: undefined,
    populated: undefined,
    wasPopulated: false,
    scope: undefined,
    activePaths: StateMachine {
      paths: Object { role: 'init', _id: 'init' },
      states: Object {
        ignore: Object {},
        default: Object {},
        init: Object { role: true, _id: true },
        modify: Object {},
        require: Object {}
      },
      stateNames: Array [ 'require', 'modify', 'init', 'default', 'ignore' ]
    },
    pathsToScopes: Object {},
    cachedRequired: Object {},
    session: undefined,
    $setCalled: Set {},
    ownerDocument: model {
      $__: InternalCache {
        strictMode: true,
        selected: Object {},
        shardval: undefined,
        saveError: undefined,
        validationError: undefined,
        adhocPaths: undefined,
        removing: undefined,
        inserting: undefined,
        saving: undefined,
        version: undefined,
        getters: Object {},
        _id: ObjectID {
          _bsontype: 'ObjectID',
          id: Buffer [ 60, 40, ee, 45, 59, 9d, 65, bb, f0, 9f, 94, 12 ]
        },
        populate: undefined,
        populated: undefined,
        wasPopulated: false,
        scope: undefined,
        activePaths: StateMachine {
          paths: Object {
            provider: 'init',
            username: 'init',
            email: 'init',
            organization: 'init',
            name: 'init',
            phone: 'init',
            password: 'init',
            canProxy: 'init',
            externalGroups: 'init',
            externalRoles: 'init',
            bypassAccessCheck: 'init',
            messagesAcknowledged: 'init',
            acceptedEua: 'init',
            lastLogin: 'init',
            newFeatureDismissed: 'init',
            _id: 'init',
            providerData: 'init',
            created: 'init',
            alertsViewed: 'init',
            teams: 'init',
            __v: 'init'
          },
          states: Object {
            ignore: Object {},
            default: Object {},
            init: Object {
              _id: true,
              phone: true,
              password: true,
              canProxy: true,
              externalGroups: true,
              externalRoles: true,
              bypassAccessCheck: true,
              messagesAcknowledged: true,
              acceptedEua: true,
              lastLogin: true,
              newFeatureDismissed: true,
              name: true,
              email: true,
              username: true,
              organization: true,
              provider: true,
              providerData: true,
              created: true,
              alertsViewed: true,
              teams: true,
              __v: true
            },
            modify: Object {},
            require: Object {}
          },
          stateNames: Array [ 'require', 'modify', 'init', 'default', 'ignore' ]
        },
        pathsToScopes: Object {},
        cachedRequired: Object {},
        session: undefined,
        $setCalled: Set {},
        ownerDocument: undefined,
        fullPath: undefined,
        emitter: EventEmitter { _events: {}, _eventsCount: 0, _maxListeners: 0 },
        $options: Object { skipId: true, isNew: false, willInit: true, defaults: true }
      },
      isNew: false,
      errors: undefined,
      $locals: Object {},
      $op: null,
      _doc: Object {
        phone: '',
        password: '',
        canProxy: false,
        externalGroups: CoreMongooseArray [],
        externalRoles: CoreMongooseArray [],
        bypassAccessCheck: false,
        messagesAcknowledged: 1969-12-31 19:00:00.000 -0500,
        acceptedEua: null,
        lastLogin: null,
        newFeatureDismissed: null,
        _id: ObjectID {
          _bsontype: 'ObjectID',
          id: Buffer [ 60, 40, ee, 45, 59, 9d, 65, bb, f0, 9f, 94, 12 ]
        },
        name: 'explicit Name',
        email: 'explicit@email.domain',
        username: 'explicit_username',
        organization: 'explicit Organization',
        provider: 'proxy-pki',
        providerData: Object { dn: 'explicit', dnLower: 'explicit' },
        created: 2021-03-04 09:27:17.217 -0500,
        alertsViewed: 2021-03-04 09:27:17.217 -0500,
        teams: CoreDocumentArray [ [Circular] ],
        __v: 0
      },
      $init: true
    },
    fullPath: 'teams',
    emitter: EventEmitter {
      _events: { isNew: Function { name: '' }, save: Function { name: '' } },
      _eventsCount: 2,
      _maxListeners: 0
    },
    $options: Object { skipId: true, willInit: true, defaults: true }
  },
  isNew: false,
  errors: undefined,
  $locals: Object {},
  $op: null,
  _doc: Object {
    role: 'member',
    _id: ObjectID {
      _bsontype: 'ObjectID',
      id: Buffer [ 60, 40, ee, 45, 59, 9d, 65, bb, f0, 9f, 94, 0d ]
    }
  },
  $init: true
} to not exist

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with teams.service.spec.js at line 341 and run the 'should delete team, if team has no resources' test repeatedly to reproduce the intermittent failure. Inspect the test's setup and cleanup around userTeam, then verify that the test passes consistently and that userTeam no longer exists after deletion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.