Skip to content

Commit

Permalink
GH-389: Fix MockReceiverTest#consumerMethods failure with reactor-cor…
Browse files Browse the repository at this point in the history
…e 3.5

Fixes: #389

Due to the change between `3.4.x` and `3.5.x` of `reactor-core`, the test would fail. 
The reason is that since `3.5` the prefetching strategy is less eager and the consumption would be paused due to lack of downstream requests. 
The assertion was to strict as in such scenarios not only the intended partition is paused but all of them. 
This relaxation makes the test pass against future reactor-core versions.
  • Loading branch information
chemicL authored Oct 31, 2024
1 parent 1789440 commit f7caa4b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2016-2024 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,6 +70,7 @@
import java.util.function.Function;
import java.util.regex.Pattern;

import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -1188,7 +1189,8 @@ public void consumerMethods() throws Exception {
testConsumerMethod(c -> {
Collection<TopicPartition> partitions = Collections.singleton(new TopicPartition(topic, 1));
c.pause(partitions);
assertEquals(partitions, c.paused());
// Due to backpressure other partitions can be paused at the same moment in time
assertThat(c.paused()).containsAll(partitions);
c.resume(partitions);
});
testConsumerMethod(c -> {
Expand Down

0 comments on commit f7caa4b

Please sign in to comment.