Skip to content

Commit 9ff68ff

Browse files
authored
Make profiler integration tests more lenient (#5942)
* Use resolveAtFirstSuccess=true for evaluating messages received by the agent * No longer rely on multiplicity
1 parent 8cdf312 commit 9ff68ff

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

integration-tests/profiler/profiler.spec.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ if (process.platform !== 'win32') {
2222
const TIMEOUT = 30000
2323

2424
function checkProfiles (agent, proc, timeout,
25-
expectedProfileTypes = DEFAULT_PROFILE_TYPES, expectBadExit = false, multiplicity = 1
25+
expectedProfileTypes = DEFAULT_PROFILE_TYPES, expectBadExit = false
2626
) {
2727
return Promise.all([
2828
processExitPromise(proc, timeout, expectBadExit),
29-
expectProfileMessagePromise(agent, timeout, expectedProfileTypes, multiplicity)
29+
expectProfileMessagePromise(agent, timeout, expectedProfileTypes)
3030
])
3131
}
3232

3333
function expectProfileMessagePromise (agent, timeout,
34-
expectedProfileTypes = DEFAULT_PROFILE_TYPES, multiplicity = 1
34+
expectedProfileTypes = DEFAULT_PROFILE_TYPES
3535
) {
3636
const fileNames = expectedProfileTypes.map(type => `${type}.pprof`)
3737
return agent.assertMessageReceived(({ headers, _, files }) => {
@@ -54,7 +54,7 @@ function expectProfileMessagePromise (agent, timeout,
5454
e.message += ` ${JSON.stringify({ headers, files, event })}`
5555
throw e
5656
}
57-
}, timeout, multiplicity)
57+
}, timeout, 1, true)
5858
}
5959

6060
function processExitPromise (proc, timeout, expectBadExit = false) {
@@ -608,7 +608,7 @@ describe('profiler', () => {
608608
cwd,
609609
env: { ...oomEnv, DD_PROFILING_WALLTIME_ENABLED: 0 }
610610
})
611-
return checkProfiles(agent, proc, timeout, ['space'], false, 2)
611+
return checkProfiles(agent, proc, timeout, ['space'], false)
612612
})
613613

614614
// Following tests are flaky because they use unreliable strategies to export profiles
@@ -624,7 +624,7 @@ describe('profiler', () => {
624624
DD_PROFILING_EXPERIMENTAL_OOM_MAX_HEAP_EXTENSION_COUNT: 3
625625
}
626626
})
627-
return checkProfiles(agent, proc, timeout, ['space'], false, 2)
627+
return checkProfiles(agent, proc, timeout, ['space'], false)
628628
}).retries(3)
629629

630630
it('sends a heap profile on OOM with async callback', () => {
@@ -652,7 +652,7 @@ describe('profiler', () => {
652652
DD_PROFILING_EXPERIMENTAL_OOM_EXPORT_STRATEGIES: 'async,process'
653653
}
654654
})
655-
return checkProfiles(agent, proc, timeout, ['space'], true, 2)
655+
return checkProfiles(agent, proc, timeout, ['space'], true)
656656
}).retries(3)
657657
}
658658
})
@@ -779,10 +779,7 @@ describe('profiler', () => {
779779
forkSsi(['create-span', 'long-lived'], whichEnv),
780780
timeout,
781781
DEFAULT_PROFILE_TYPES,
782-
false,
783-
// Will receive 2 messages: first one is for the trace, second one is for the profile. We
784-
// only need the assertions in checkProfiles to succeed for the one with the profile.
785-
2)
782+
false)
786783
}
787784

788785
function heuristicsDoesNotTriggerFor (args, allowTraceMessage, whichEnv) {

0 commit comments

Comments
 (0)