From 782ca9a0c831488e73132246a9b17abb7426b503 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 5 Dec 2024 19:20:11 +0000 Subject: [PATCH 1/3] fix(test-utils): Don't swallow assertion errors from `checkResult` and `checkCollector`. --- packages/opentelemetry-test-utils/src/test-fixtures.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/opentelemetry-test-utils/src/test-fixtures.ts b/packages/opentelemetry-test-utils/src/test-fixtures.ts index 37995ffa04..ff76db0d7b 100644 --- a/packages/opentelemetry-test-utils/src/test-fixtures.ts +++ b/packages/opentelemetry-test-utils/src/test-fixtures.ts @@ -236,7 +236,7 @@ export async function runTestFixture( const collector = new TestCollector(); await collector.start(); - return new Promise(resolve => { + return new Promise((resolve, reject) => { execFile( process.execPath, opts.argv, @@ -261,6 +261,8 @@ export async function runTestFixture( if (opts.checkCollector) { await opts.checkCollector(collector); } + } catch(err) { + reject(err); } finally { collector.close(); resolve(); From 11e73312cf924ea561dca95c4982b1c224b66cbb Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 5 Dec 2024 19:36:56 +0000 Subject: [PATCH 2/3] Lint --- packages/opentelemetry-test-utils/src/test-fixtures.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opentelemetry-test-utils/src/test-fixtures.ts b/packages/opentelemetry-test-utils/src/test-fixtures.ts index ff76db0d7b..c96c5927b5 100644 --- a/packages/opentelemetry-test-utils/src/test-fixtures.ts +++ b/packages/opentelemetry-test-utils/src/test-fixtures.ts @@ -261,7 +261,7 @@ export async function runTestFixture( if (opts.checkCollector) { await opts.checkCollector(collector); } - } catch(err) { + } catch (err) { reject(err); } finally { collector.close(); From 6dae216450581eb4d241d0bda6a0f5c0fd5c7921 Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 5 Dec 2024 19:40:36 +0000 Subject: [PATCH 3/3] Fix Hapi ESM test. --- .../test/hapi.test.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts b/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts index af87e04901..48e2c51912 100644 --- a/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts +++ b/plugins/node/opentelemetry-instrumentation-hapi/test/hapi.test.ts @@ -557,15 +557,24 @@ describe('Hapi Instrumentation - Core Tests', () => { }, checkCollector: (collector: TestCollector) => { const spans = collector.sortedSpans; - assert.strictEqual(spans.length, 2); - assert.strictEqual(spans[0].name, 'GET /route/{param}'); + + assert.strictEqual(spans.length, 3); + + assert.strictEqual(spans[0].name, 'GET'); assert.strictEqual( spans[0].instrumentationScope.name, '@opentelemetry/instrumentation-http' ); - assert.strictEqual(spans[1].name, 'route - /route/{param}'); + + assert.strictEqual(spans[1].name, 'GET /route/{param}'); assert.strictEqual( spans[1].instrumentationScope.name, + '@opentelemetry/instrumentation-http' + ); + + assert.strictEqual(spans[2].name, 'route - /route/{param}'); + assert.strictEqual( + spans[2].instrumentationScope.name, '@opentelemetry/instrumentation-hapi' ); },