diff --git a/sdk/monitor/monitor-opentelemetry-exporter/package.json b/sdk/monitor/monitor-opentelemetry-exporter/package.json index b5dcf6bd302a..1bfc912348ea 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/package.json +++ b/sdk/monitor/monitor-opentelemetry-exporter/package.json @@ -75,6 +75,7 @@ }, "devDependencies": { "@azure-tools/test-utils-vitest": "^1.0.0", + "@azure/core-util": "^1.11.0", "@azure/dev-tool": "^1.0.0", "@azure/eslint-plugin-azure-sdk": "^3.0.0", "@opentelemetry/instrumentation": "^0.56.0", diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts index a10f52b03c93..076ec46945d0 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/log.test.ts @@ -40,7 +40,7 @@ describe("Log Exporter Scenarios", () => { setTimeout(() => { assertLogExpectation(ingest, scenario.expectation); assertCount(ingest, scenario.expectation); - }, 1); + }, 100); }); }); }); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts index 5573471e7704..c5a999b62129 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/metric.test.ts @@ -35,8 +35,10 @@ describe("Metric Exporter Scenarios", () => { await scenario.run(); // promisify doesn't work on this, so use callbacks/done for now await scenario.flush(); - assertMetricExpectation(ingest, scenario.expectation); - assertCount(ingest, scenario.expectation); + setTimeout(() => { + assertMetricExpectation(ingest, scenario.expectation); + assertCount(ingest, scenario.expectation); + }, 100); }); }); }); diff --git a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/trace.test.ts b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/trace.test.ts index be303e995bc4..8fa6f46b8126 100644 --- a/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/trace.test.ts +++ b/sdk/monitor/monitor-opentelemetry-exporter/test/internal/functional/trace.test.ts @@ -37,8 +37,10 @@ describe("Trace Exporter Scenarios", () => { it("should work", async () => { await scenario.run(); await scenario.flush(); - assertTraceExpectation(ingest, scenario.expectation); - assertCount(ingest, scenario.expectation); + setTimeout(() => { + assertTraceExpectation(ingest, scenario.expectation); + assertCount(ingest, scenario.expectation); + }, 100); }); }); @@ -69,10 +71,11 @@ describe("Trace Exporter Scenarios", () => { it("should work with OTel resource metric disabled", async () => { await scenario.run(); - await scenario.flush(); - assertTraceExpectation(ingest, scenario.disabledExpectation); - assertCount(ingest, scenario.disabledExpectation); + setTimeout(() => { + assertTraceExpectation(ingest, scenario.disabledExpectation); + assertCount(ingest, scenario.disabledExpectation); + }, 100); }); }); }); diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standardMetrics.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standardMetrics.test.ts index b688cfd60876..24fb1942bca1 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standardMetrics.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standardMetrics.test.ts @@ -244,7 +244,7 @@ describe("#StandardMetricsHandler", () => { autoCollect.recordSpan(serverSpan); } - await new Promise((resolve) => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1500)); assert.ok(exportStub.called); const resourceMetrics = exportStub.args[0][0]; const scopeMetrics = resourceMetrics.scopeMetrics;