ableegoldman commented on a change in pull request #8540: URL: https://github.com/apache/kafka/pull/8540#discussion_r414819765
########## File path: streams/src/test/java/org/apache/kafka/streams/KafkaStreamsTest.java ########## @@ -883,6 +887,50 @@ public void statefulTopologyShouldCreateStateDirectory() throws Exception { startStreamsAndCheckDirExists(topology, true); } + @Test + public void shouldThrowIllegalArgumentExceptionOnEmptyTopology() { + assertThrows( + IllegalArgumentException.class, + () -> new KafkaStreams(new StreamsBuilder().build(), props, supplier, time) + ); + } + + @Test + public void shouldNotCreateStreamThreadsForGlobalOnlyTopology() { + final StreamsBuilder builder = new StreamsBuilder(); + builder.globalTable("anyTopic"); + final KafkaStreams streams = new KafkaStreams(builder.build(), props, supplier, time); + + assertThat(streams.threads.length, equalTo(0)); + } + + @Test + public void shouldNotTransitToErrorStateWithGlobalOnlyTopology() throws InterruptedException { + final StreamsBuilder builder = new StreamsBuilder(); + builder.globalTable("anyTopic"); + final KafkaStreams streams = new KafkaStreams(builder.build(), props, supplier, time); + streams.setStateListener((newState, oldState) -> { + if (newState.equals(State.ERROR)) { + throw new AssertionError("Should not have transitioned to ERROR state with no stream threads"); Review comment: I guess we don't need to throw here, it would just cause KafkaStreams to transition to ERROR and fail below. But I realized this doesn't even do that because we're mocking pretty much everything in this test class including the stream threads. I'll try to look for a better way and place to do this test ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org