Skip to content

Commit

Permalink
Tweak SessionIT test
Browse files Browse the repository at this point in the history
Seeing warnings in CI but not locally; exception logs as a ValidationException but isn't instanceof IllegalArgumentException? Odd, because the later assertions on count still passed (?), and so not counted as an IT failure.
  • Loading branch information
jhy committed Jan 15, 2025
1 parent 62674f9 commit 5594c17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/test/java/org/jsoup/integration/SessionIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public void multiThreadWithoutNewRequestBlowsUp() throws InterruptedException {
}
});
thread.setName("Runner-" + threadNum);
thread.start();
thread.setUncaughtExceptionHandler(catcher);
thread.start();
threads[threadNum] = thread;
}

Expand All @@ -111,7 +111,7 @@ public void multiThreadWithoutNewRequestBlowsUp() throws InterruptedException {

/* The checks above work when all 20 threads are executed within 10 seconds. However, depending on how cloudy it
is when the CI jobs are run, they may not all complete in time. As of writing that appears most commonly on the
maxOS runners, which appear overtaxed. That makes this test flaky. So we relax the test conditions, and make
macOS runners, which appear overtaxed. That makes this test flaky. So we relax the test conditions, and make
sure at least just one passed and one failed. That's OK in prod as well, because we are only concerned about
concurrent execution, which the impl does detect correctly. */
assertTrue(successful.get() > 0);
Expand Down Expand Up @@ -155,8 +155,8 @@ public void multiThreadWithProgressListener() throws InterruptedException {
}
});
thread.setName("Runner-" + threadNum);
thread.start();
thread.setUncaughtExceptionHandler(catcher);
thread.start();
threads[threadNum] = thread;
}

Expand All @@ -177,7 +177,7 @@ static class ThreadCatcher implements Thread.UncaughtExceptionHandler {

@Override
public void uncaughtException(Thread t, Throwable e) {
if (e instanceof IllegalArgumentException && e.getMessage().contains("Multiple threads"))
if (e.getMessage().contains("Multiple threads"))
multiThreadExceptions.incrementAndGet();
else
e.printStackTrace();
Expand Down

0 comments on commit 5594c17

Please sign in to comment.