Commit 9b2c6f0
committed
Fix AutoCleanupExtension.deferAfterAll firing per @nested container
AfterAllCallback.afterAll() fires once per container the extension is
registered in, including each @nested class (since static @RegisterExtension
fields are inherited). This caused deferAfterAll cleanups to run as soon
as the first nested container completed.
Track the outermost container via beforeAll and only run deferAfterAll
cleanups when afterAll fires on that same context.
This was breaking ApacheHttpAsyncClientTest, where the shared async
clients were closed after the first nested test class finished, causing
all subsequent nested tests to fail with CancellationException.1 parent d9fba53 commit 9b2c6f0
1 file changed
Lines changed: 18 additions & 1 deletion
File tree
- testing-common/src/main/java/io/opentelemetry/instrumentation/testing/internal
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
| |||
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
59 | 76 | | |
60 | 77 | | |
61 | 78 | | |
| |||
0 commit comments