From 70fd11cf5ae4f72656b84ac9e082f2e0920b0b1a Mon Sep 17 00:00:00 2001 From: Ugaitz Urien Date: Mon, 17 Jun 2024 16:36:19 +0200 Subject: [PATCH] Small changes --- integration-tests/appsec/index.spec.js | 18 +++++++------- .../test/http.spec.js | 24 +++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/integration-tests/appsec/index.spec.js b/integration-tests/appsec/index.spec.js index 5eb527706db..3a179ff783b 100644 --- a/integration-tests/appsec/index.spec.js +++ b/integration-tests/appsec/index.spec.js @@ -90,39 +90,39 @@ describe('RASP', () => { } }) - it('should not crash the app when app send data after blocking', () => { + it('should not crash when app send data after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-A') }) - it('should not crash the app when app stream data after blocking', () => { + it('should not crash when app stream data after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-B') }) - it('should not crash the app when setHeader, writeHead or end after blocking', () => { + it('should not crash when setHeader, writeHead or end after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-C') }) - it('should not crash the app when appendHeader, flushHeaders, removeHeader after blocking', () => { + it('should not crash when appendHeader, flushHeaders, removeHeader after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-D') }) - it('should not crash the app when writeContinue after blocking', () => { + it('should not crash when writeContinue after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-E') }) - it('should not crash the app when writeProcessing after blocking', () => { + it('should not crash when writeProcessing after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-F') }) - it('should not crash the app when writeEarlyHints after blocking', () => { + it('should not crash when writeEarlyHints after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-G') }) - it('should not crash the app when res.json after blocking', () => { + it('should not crash when res.json after blocking', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-async-write-H') }) - it('should not crash the when is blocked using axios', () => { + it('should not crash when is blocked using axios', () => { return testNotCrashedAfterBlocking('/ssrf/http/unhandled-axios') }) }) diff --git a/packages/datadog-instrumentations/test/http.spec.js b/packages/datadog-instrumentations/test/http.spec.js index a015465afc1..021b85871f9 100644 --- a/packages/datadog-instrumentations/test/http.spec.js +++ b/packages/datadog-instrumentations/test/http.spec.js @@ -81,21 +81,15 @@ describe('client', () => { assert.instanceOf(ctx.abortController, AbortController) }) - it('Request is aborted with default error', (done) => { + it('Request is aborted', (done) => { startChannelCb.callsFake(abortCallback) const cr = http.get(url, () => { - done('Request should be blocked') + done(new Error('Request should be blocked')) }) - cr.on('error', (e) => { - try { - assert.instanceOf(e, Error) - - done() - } catch (e) { - done(e) - } + cr.on('error', () => { + done() }) }) @@ -109,7 +103,7 @@ describe('client', () => { }) const cr = http.get(url, () => { - done('Request should be blocked') + done(new Error('Request should be blocked')) }) cr.on('error', (e) => { @@ -128,7 +122,7 @@ describe('client', () => { startChannelCb.callsFake(abortCallback) const cr = http.get(url, () => { - done('Request should be blocked') + done(new Error('Request should be blocked')) }) cr.on('error', () => { @@ -147,7 +141,7 @@ describe('client', () => { startChannelCb.callsFake(abortCallback) const cr = http.get(url, () => { - done('Request should be blocked') + done(new Error('Request should be blocked')) }) cr.on('error', () => { @@ -167,7 +161,7 @@ describe('client', () => { startChannelCb.callsFake(abortCallback) const cr = http.get(url, () => { - done('Request should be blocked') + done(new Error('Request should be blocked')) }) cr.on('error', () => { @@ -183,7 +177,7 @@ describe('client', () => { done(e.message) } }) - }).timeout(1000) + }) }) }) })