Commit aa57bcf
Fix flaky cron trigger test by closing context before assertions
The "schedule trigger test according to cron expression" test was flaky
because the cron expression (every 5 seconds) could fire a second time
between blockUntilExecute() returning and the assertTraces() call
completing, producing 3 or 4 traces instead of the expected 2.
Fix by closing the Spring application context immediately after the
first execution completes, before entering the expect block. The
ScheduledTasksEndpoint bean reference is captured before closing so
the endpoint assertion in the and: block still works.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent cc12228 commit aa57bcf
File tree
2 files changed
+8
-6
lines changed- dd-java-agent/instrumentation/spring/spring-scheduling-3.1/src
- latestDepTest/groovy
- test/groovy
2 files changed
+8
-6
lines changedLines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
63 | | - | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
57 | | - | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
63 | | - | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
0 commit comments