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 Apr 29, 2024
1 parent ebea361 commit 4aa5e91
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ void testHighPrioPool() {

final long start = System.currentTimeMillis();

when(this.permitReleasedNotifier.waitForAvailablePermit(btsId, cellId, 1000))
.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 4aa5e91

Please sign in to comment.