Skip to content

Commit 584f3ff

Browse files
authored
fix(test): always record AssertionErrors in InteractiveUserEmulator (#231)
The `close()` sets `closing=true` before `awaitTermination`, so any in-flight user task that calls `recordFailure` after that point would silently drop its error under the !closing.get() guard, making the failure invisible. `AssertionError`s are always deliberate test failures and are never produced by shutdown I/O, so they should be recorded unconditionally regardless of closing state.
1 parent f9a37dc commit 584f3ff

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

oauth2/core/src/testFixtures/java/com/dremio/iceberg/authmgr/oauth2/test/user/InteractiveUserEmulator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ private static URI extractAuthUrl(String line) {
148148
}
149149

150150
private void recordFailure(Throwable t) {
151-
if (!closing.get()) {
151+
// AssertionErrors are always genuine test failures and are never produced by
152+
// shutdown I/O noise, so record them unconditionally even after close() has
153+
// set closing=true.
154+
if (t instanceof AssertionError || !closing.get()) {
152155
error.accumulateAndGet(
153156
t,
154157
(t1, t2) -> {
@@ -159,6 +162,8 @@ private void recordFailure(Throwable t) {
159162
return t1;
160163
}
161164
});
165+
}
166+
if (!closing.get()) {
162167
for (Consumer<Throwable> l : errorListeners) {
163168
try {
164169
l.accept(t);

0 commit comments

Comments
 (0)