Testing getAuditById() issue
rcrichton opened this issue · comments
Occasionally get this error during testing:
1) API Integration Tests Audits REST Api testing *getAuditById (auditId) should generate an 'audit log used' audit:
Uncaught AssertionError: expected 1 to be 2
+ expected - actual
-1
+2
at Assertion.fail (node_modules/should/cjs/should.js:326:17)
at Assertion.Object.defineProperty.value (node_modules/should/cjs/should.js:398:19)
at Query.<anonymous> (test/integration/auditAPITests.coffee:317:46)
at node_modules/mongoose/node_modules/kareem/index.js:177:19
at node_modules/mongoose/node_modules/kareem/index.js:109:16
Put a callback here so we know that the audit event has been created.
I think it makes sense to only return audits from a get if the 'audit log used' event is created.
@napiergit the auditing was intentionally setup to fire async for performance. I think we need to rather deal with that aspect at testing level rather than altering the existing code to fit the tests.