Skip to content

Commit 3bb5862

Browse files
committed
similar race in resource-detector-container test
1 parent 57756c8 commit 3bb5862

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

detectors/node/opentelemetry-resource-detector-container/test/ContainerDetectorIntegration.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ import { IResource } from '@opentelemetry/resources';
2727
describe('[Integration] ContainerDetector', () => {
2828
it('should not start spans for detector reads to filesystem', async () => {
2929
const memoryExporter = new InMemorySpanExporter();
30+
const spanProcessor = new SimpleSpanProcessor(memoryExporter);
3031
const sdk = new NodeSDK({
3132
instrumentations: [new FsInstrumentation()],
32-
spanProcessors: [new SimpleSpanProcessor(memoryExporter)],
33+
spanProcessors: [spanProcessor],
3334
});
3435

3536
sdk.start();
@@ -50,7 +51,7 @@ describe('[Integration] ContainerDetector', () => {
5051

5152
// NOTE: the require process makes use of the fs API so spans are being exported.
5253
// We need to check no new spans are exported when `detect` is called.
53-
await new Promise(r => setTimeout(r, 0));
54+
await spanProcessor.forceFlush();
5455
const numSpansAfterRequire = memoryExporter.getFinishedSpans().length;
5556

5657
const resource = containerDetector.detect() as IResource;

0 commit comments

Comments
 (0)