Skip to content

Commit

Permalink
[FLINK-30275][tests] Fix off-by-one error in TaskExecutorTest.testSha…
Browse files Browse the repository at this point in the history
…redResourcesLifecycle
  • Loading branch information
rkhachatryan committed Dec 2, 2022
1 parent fb27e68 commit 6b68bc6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ private static <T> T callInMain(TaskExecutorTestingContext ctx, Callable<T> bool
public void testSharedResourcesLifecycle() throws Exception {
SharedResourceCollectingInvokable.reset();
AllocationID[] slots =
range(0, 5).mapToObj(i -> new AllocationID()).toArray(AllocationID[]::new);
range(0, 10).mapToObj(i -> new AllocationID()).toArray(AllocationID[]::new);

try (TaskExecutorTestingContext ctx = createTaskExecutorTestingContext(slots.length)) {
// prepare: start services
Expand Down Expand Up @@ -3073,7 +3073,7 @@ public void testSharedResourcesLifecycle() throws Exception {
// cancel tasks
// verify that the resource is not released as long as there are tasks running
for (int i = 0; i < executions.size(); i++) {
int numRemaining = slots.length - i;
int numRemaining = slots.length - i + 1;
ctx.taskExecutor.cancelTask(executions.get(i), timeout).get();
waitForTasks(ctx, numTasks -> numTasks > numRemaining);
if (numRemaining > 0) {
Expand Down

0 comments on commit 6b68bc6

Please sign in to comment.