Skip to content

Commit

Permalink
Fix Flaky throttling test
Browse files Browse the repository at this point in the history
Move then when then outside the multithreaded execution.
This could reduce weird behavior in the mockito mocking storage

Signed-off-by: Jasper Kamerling <[email protected]>
  • Loading branch information
jasperkamerling committed May 2, 2024
1 parent ebea361 commit 578b6bf
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,13 @@ void testHighPrioPool() {

final long start = System.currentTimeMillis();

when(this.permitReleasedNotifier.waitForAvailablePermit(btsId, cellId, 1000))
.thenReturn(false)
.thenReturn(true);

final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(2);
executor.schedule(
() -> {
when(this.permitReleasedNotifier.waitForAvailablePermit(btsId, cellId, 1000))
.thenReturn(false)
.thenReturn(true);
this.permitsPerNetworkSegment.releasePermit(
throttlingConfigId, clientId, btsId, cellId, requestId);

Expand Down

0 comments on commit 578b6bf

Please sign in to comment.