diff --git a/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dns-lookup.test.ts b/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dns-lookup.test.ts index 8c5a42d33b..8bd5ad698a 100644 --- a/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dns-lookup.test.ts +++ b/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dns-lookup.test.ts @@ -98,24 +98,30 @@ describe('dns.lookup()', () => { }); }); - it('should export a valid span with error NOT_FOUND', done => { - const hostname = 'ᚕ'; - dns.lookup(hostname, (err, address, family) => { - assert.ok(err); + describe('extended timeout', function () { + // Extending the default timeout as some environments are taking longer than 2 seconds to fail + // So rather than fail the test -- just take a little longer + this.timeout(10000); - const spans = memoryExporter.getFinishedSpans(); - const [span] = spans; + it('should export a valid span with error NOT_FOUND', done => { + const hostname = 'ᚕ'; + dns.lookup(hostname, (err, address, family) => { + assert.ok(err); - assert.strictEqual(spans.length, 1); - assertSpan(span, { - addresses: [{ address, family }], - hostname, - forceStatus: { - code: SpanStatusCode.ERROR, - message: err!.message, - }, + const spans = memoryExporter.getFinishedSpans(); + const [span] = spans; + + assert.strictEqual(spans.length, 1); + assertSpan(span, { + addresses: [{ address, family }], + hostname, + forceStatus: { + code: SpanStatusCode.ERROR, + message: err!.message, + }, + }); + done(); }); - done(); }); }); diff --git a/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dnspromise-lookup.test.ts b/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dnspromise-lookup.test.ts index 68e9414151..bb9988ee1f 100644 --- a/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dnspromise-lookup.test.ts +++ b/plugins/node/opentelemetry-instrumentation-dns/test/integrations/dnspromise-lookup.test.ts @@ -111,25 +111,31 @@ describe('dns.promises.lookup()', () => { assertSpan(span, { addresses: [{ address, family }], hostname }); }); - it('should export a valid span with error NOT_FOUND', async () => { - const hostname = 'ᚕ'; - try { - await lookupPromise(hostname); - assert.fail(); - } catch (error) { - const spans = memoryExporter.getFinishedSpans(); - const [span] = spans; - - assert.strictEqual(spans.length, 1); - assertSpan(span, { - addresses: [], - hostname, - forceStatus: { - code: SpanStatusCode.ERROR, - message: error!.message, - }, - }); - } + describe('extended timeout', function () { + // Extending the default timeout as some environments are taking longer than 2 seconds to fail + // So rather than fail the test -- just take a little longer + this.timeout(10000); + + it('should export a valid span with error NOT_FOUND', async () => { + const hostname = 'ᚕ'; + try { + await lookupPromise(hostname); + assert.fail(); + } catch (error) { + const spans = memoryExporter.getFinishedSpans(); + const [span] = spans; + + assert.strictEqual(spans.length, 1); + assertSpan(span, { + addresses: [], + hostname, + forceStatus: { + code: SpanStatusCode.ERROR, + message: error!.message, + }, + }); + } + }); }); it('should export a valid span with error INVALID_ARGUMENT when "family" param is equal to -1', async () => {