wcarlson5 commented on a change in pull request #11479:
URL: https://github.com/apache/kafka/pull/11479#discussion_r746918532



##########
File path: 
streams/src/test/java/org/apache/kafka/streams/integration/NamedTopologyIntegrationTest.java
##########
@@ -425,6 +428,36 @@ public void 
shouldAllowMixedCollectionAndPatternSubscriptionWithMultipleNamedTop
         assertThat(waitUntilMinKeyValueRecordsReceived(consumerConfig, 
OUTPUT_STREAM_3, 3), equalTo(COUNT_OUTPUT_DATA));
     }
 
+    @Test
+    public void 
shouldAddToEmptyInitialTopologyRemoveResetOffsetsThenAddSameNamedTopology() 
throws Exception {
+        CLUSTER.createTopics(SUM_OUTPUT, COUNT_OUTPUT);
+        // Build up named topology with two stateful subtopologies
+        final KStream<String, Long> inputStream1 = 
topology1Builder.stream(INPUT_STREAM_1);
+        inputStream1.groupByKey().count().toStream().to(COUNT_OUTPUT);
+        inputStream1.groupByKey().reduce(Long::sum).toStream().to(SUM_OUTPUT);
+        streams = new KafkaStreamsNamedTopologyWrapper(props, clientSupplier);
+        streams.start();
+        final NamedTopology namedTopology = 
topology1Builder.buildNamedTopology(props);
+        streams.addNamedTopology(namedTopology).all().get();
+
+        assertThat(waitUntilMinKeyValueRecordsReceived(consumerConfig, 
COUNT_OUTPUT, 3), equalTo(COUNT_OUTPUT_DATA));
+        assertThat(waitUntilMinKeyValueRecordsReceived(consumerConfig, 
SUM_OUTPUT, 3), equalTo(SUM_OUTPUT_DATA));
+        streams.removeNamedTopology("topology-1", true).all().get();
+        streams.cleanUpNamedTopology("topology-1");
+
+        final KStream<String, Long> inputStream = 
topology1BuilderDup.stream(INPUT_STREAM_1);
+        inputStream.groupByKey().count().toStream().to(COUNT_OUTPUT);
+        inputStream.groupByKey().reduce(Long::sum).toStream().to(SUM_OUTPUT);
+
+        final NamedTopology namedTopologyDup = 
topology1BuilderDup.buildNamedTopology(props);
+        streams.addNamedTopology(namedTopologyDup).all().get();
+        assertThat(waitUntilMinKeyValueRecordsReceived(consumerConfig, 
COUNT_OUTPUT, 3), equalTo(COUNT_OUTPUT_DATA));

Review comment:
       This is getting double counted right now because when removing a Named 
topology I need to delete any change-log or stores associated with it




-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to