Skip to content

Commit 00efd03

Browse files
authored
test: speed up DI integration tests (#5823)
No need to install dependencies in the sandbox that isn't required.
1 parent cc2b8a6 commit 00efd03

File tree

8 files changed

+31
-14
lines changed

8 files changed

+31
-14
lines changed

integration-tests/debugger/basic.spec.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { version } = require('../../package.json')
1010

1111
describe('Dynamic Instrumentation', function () {
1212
describe('Default env', function () {
13-
const t = setup()
13+
const t = setup({ dependencies: ['fastify'] })
1414

1515
it('base case: target app should work as expected if no test probe has been added', async function () {
1616
const response = await t.axios.get(t.breakpoint.url)
@@ -727,7 +727,10 @@ describe('Dynamic Instrumentation', function () {
727727
})
728728

729729
describe('DD_TRACING_ENABLED=true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED=true', function () {
730-
const t = setup({ env: { DD_TRACING_ENABLED: true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED: true } })
730+
const t = setup({
731+
env: { DD_TRACING_ENABLED: true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED: true },
732+
dependencies: ['fastify']
733+
})
731734

732735
describe('input messages', function () {
733736
it(
@@ -738,7 +741,10 @@ describe('Dynamic Instrumentation', function () {
738741
})
739742

740743
describe('DD_TRACING_ENABLED=true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED=false', function () {
741-
const t = setup({ env: { DD_TRACING_ENABLED: true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED: false } })
744+
const t = setup({
745+
env: { DD_TRACING_ENABLED: true, DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED: false },
746+
dependencies: ['fastify']
747+
})
742748

743749
describe('input messages', function () {
744750
it(
@@ -749,7 +755,10 @@ describe('Dynamic Instrumentation', function () {
749755
})
750756

751757
describe('DD_TRACING_ENABLED=false', function () {
752-
const t = setup({ env: { DD_TRACING_ENABLED: false } })
758+
const t = setup({
759+
env: { DD_TRACING_ENABLED: false },
760+
dependencies: ['fastify']
761+
})
753762

754763
describe('input messages', function () {
755764
it(

integration-tests/debugger/ddtags.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ describe('Dynamic Instrumentation', function () {
1616
DD_GIT_COMMIT_SHA: 'test-commit-sha',
1717
DD_GIT_REPOSITORY_URL: 'test-repository-url'
1818
},
19-
testApp: 'target-app/basic.js'
19+
testApp: 'target-app/basic.js',
20+
dependencies: ['fastify']
2021
})
2122

2223
it('should add the expected ddtags as a query param to /debugger/v1/input', function (done) {
@@ -51,7 +52,7 @@ describe('Dynamic Instrumentation', function () {
5152
})
5253

5354
describe('with undefined values', function () {
54-
const t = setup({ testApp: 'target-app/basic.js' })
55+
const t = setup({ testApp: 'target-app/basic.js', dependencies: ['fastify'] })
5556

5657
it('should not include undefined values in the ddtags query param', function (done) {
5758
t.triggerBreakpoint()

integration-tests/debugger/redact.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ const { once } = require('node:events')
77
// Default settings is tested in unit tests, so we only need to test the env vars here
88
describe('Dynamic Instrumentation snapshot PII redaction', function () {
99
describe('DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS=foo,bar', function () {
10-
const t = setup({ env: { DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS: 'foo,bar' } })
10+
const t = setup({
11+
env: { DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS: 'foo,bar' },
12+
dependencies: ['fastify']
13+
})
1114

1215
it('should respect DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS', async function () {
1316
t.triggerBreakpoint()
@@ -29,7 +32,10 @@ describe('Dynamic Instrumentation snapshot PII redaction', function () {
2932
})
3033

3134
describe('DD_DYNAMIC_INSTRUMENTATION_REDACTION_EXCLUDED_IDENTIFIERS=secret', function () {
32-
const t = setup({ env: { DD_DYNAMIC_INSTRUMENTATION_REDACTION_EXCLUDED_IDENTIFIERS: 'secret' } })
35+
const t = setup({
36+
env: { DD_DYNAMIC_INSTRUMENTATION_REDACTION_EXCLUDED_IDENTIFIERS: 'secret' },
37+
dependencies: ['fastify']
38+
})
3339

3440
it('should respect DD_DYNAMIC_INSTRUMENTATION_REDACTED_IDENTIFIERS', async function () {
3541
t.triggerBreakpoint()

integration-tests/debugger/snapshot-global-sample-rate.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const { setup } = require('./utils')
55

66
describe('Dynamic Instrumentation', function () {
77
const t = setup({
8-
testApp: 'target-app/basic.js'
8+
testApp: 'target-app/basic.js',
9+
dependencies: ['fastify']
910
})
1011

1112
describe('input messages', function () {

integration-tests/debugger/snapshot-pruning.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { assert } = require('chai')
44
const { setup } = require('./utils')
55

66
describe('Dynamic Instrumentation', function () {
7-
const t = setup()
7+
const t = setup({ dependencies: ['fastify'] })
88

99
describe('input messages', function () {
1010
describe('with snapshot', function () {

integration-tests/debugger/snapshot.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { assert } = require('chai')
44
const { setup } = require('./utils')
55

66
describe('Dynamic Instrumentation', function () {
7-
const t = setup()
7+
const t = setup({ dependencies: ['fastify'] })
88

99
describe('input messages', function () {
1010
describe('with snapshot', function () {

integration-tests/debugger/template.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { NODE_MAJOR } = require('../../version')
66

77
describe('Dynamic Instrumentation', function () {
88
describe('template evaluation', function () {
9-
const t = setup()
9+
const t = setup({ dependencies: ['fastify'] })
1010

1111
beforeEach(t.triggerBreakpoint)
1212

integration-tests/debugger/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
setup
1919
}
2020

21-
function setup ({ env, testApp, testAppSource } = {}) {
21+
function setup ({ env, testApp, testAppSource, dependencies } = {}) {
2222
let sandbox, cwd, appPort
2323
const breakpoints = getBreakpointInfo({
2424
deployedFile: testApp,
@@ -74,7 +74,7 @@ function setup ({ env, testApp, testAppSource } = {}) {
7474
}
7575

7676
before(async function () {
77-
sandbox = await createSandbox(['fastify']) // TODO: Make this dynamic
77+
sandbox = await createSandbox(dependencies)
7878
cwd = sandbox.folder
7979
// The sandbox uses the `integration-tests` folder as its root
8080
t.appFile = join(cwd, 'debugger', breakpoints[0].deployedFile)

0 commit comments

Comments
 (0)