Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static org.apache.kafka.common.utils.Utils.mkMap;
import static org.apache.kafka.common.utils.Utils.mkProperties;
import static org.apache.kafka.streams.processor.internals.assignment.StreamsAssignmentProtocolVersions.LATEST_SUPPORTED_VERSION;
import static org.apache.kafka.test.TestUtils.retryOnExceptionWithTimeout;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

Expand Down Expand Up @@ -87,9 +88,9 @@ public void testVersionProbingUpgrade() throws InterruptedException {
final AtomicInteger usedVersion6 = new AtomicInteger();
final KafkaStreams kafkaStreams6 = buildFutureStreams(usedVersion6);
startSync(kafkaStreams6);
assertThat(usedVersion6.get(), is(LATEST_SUPPORTED_VERSION + 1));
assertThat(usedVersion5.get(), is(LATEST_SUPPORTED_VERSION + 1));
assertThat(usedVersion4.get(), is(LATEST_SUPPORTED_VERSION + 1));
retryOnExceptionWithTimeout(() -> assertThat(usedVersion6.get(), is(LATEST_SUPPORTED_VERSION + 1)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider doing the same for second / first roll as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @guozhangwang . It should be unnecessary, since they already block until running (in startSync), and they should have gotten the expected number deterministically before transitioning to running. Time will tell if I am wrong, though...

retryOnExceptionWithTimeout(() -> assertThat(usedVersion5.get(), is(LATEST_SUPPORTED_VERSION + 1)));
retryOnExceptionWithTimeout(() -> assertThat(usedVersion4.get(), is(LATEST_SUPPORTED_VERSION + 1)));

kafkaStreams4.close(Duration.ZERO);
kafkaStreams5.close(Duration.ZERO);
Expand All @@ -99,14 +100,14 @@ public void testVersionProbingUpgrade() throws InterruptedException {
kafkaStreams6.close();
}

public static KafkaStreams buildFutureStreams(final AtomicInteger usedVersion4) {
private static KafkaStreams buildFutureStreams(final AtomicInteger usedVersion4) {
final Properties properties = new Properties();
properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
properties.put("test.future.metadata", usedVersion4);
return StreamsUpgradeTest.buildStreams(properties);
}

public static void startSync(final KafkaStreams... kafkaStreams) throws InterruptedException {
private static void startSync(final KafkaStreams... kafkaStreams) throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(kafkaStreams.length);
for (final KafkaStreams streams : kafkaStreams) {
streams.setStateListener((newState, oldState) -> {
Expand Down