Skip to content

tests: possible flaky test in mongodb instrumentation package #2757

Open
@david-luna

Description

@david-luna

There's been some failures recently in Unit tests workflow. These failures happen in some PRs
and also in main branch

The issue seems to happen for mongodb v3 tests and in node v20 giving the following output.

> @opentelemetry/[email protected] test-v3-run
> nyc --no-clean mocha --require '@opentelemetry/contrib-test-utils' 'test/**/mongodb-v3.test.ts'



  MongoDBInstrumentation-Tracing-v3
(node:10022) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-warnings ...` to show where the warning was created)
    Instrumenting query operations
      ✔ should create a child span for insert
      ✔ should create a child span for update
      ✔ should create a child span for remove
    Instrumenting cursor operations
      ✔ should create a child span for find
      ✔ should create a child span for cursor operations
    Instrumenting command operations
      ✔ should create a child span for create index
      ✔ should create a child span for aggregation
    when using enhanced database reporting without db statementSerializer
      ✔ should properly collect db statement (hide attribute values)
      ✔ should properly collect nested db statement (hide attribute values)
    when specifying a dbStatementSerializer configuration
      with a valid function
        ✔ should properly collect db statement
      with an invalid function
        ✔ should not do any harm when throwing an exception
    when specifying a responseHook configuration
      with a valid function
        ✔ should attach response hook data to the resulting span for insert function
        ✔ should attach response hook data to the resulting span for find function
      with an invalid function
        ✔ should not do any harm when throwing an exception
    Mixed operations with callback
      ✔ should create a span for find after callback insert
    MongoDb useUnifiedTopology enabled
      ✔ should generate correct span attributes
    requireParentSpan
      1) should not create spans without parent span when requireParentSpan is explicitly set to true
      ✔ should create spans without parent span when requireParentSpan is false
    Removing Instrumentation
      ✔ should unpatch plugin
      ✔ should not create a child span for query
      ✔ should not create a child span for cursor
      ✔ should not create a child span for command


  21 passing (348ms)
  1 failing

Such tests for v3 were previously executed only for TAV testing but they were introduced in #2681 to increase the number in coverage report.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions