muralibasani commented on code in PR #22901:
URL: https://github.com/apache/kafka/pull/22901#discussion_r3722869184


##########
streams/integration-tests/src/test/java/org/apache/kafka/streams/integration/HeadersStoreUpgradeIntegrationTest.java:
##########
@@ -135,6 +137,117 @@ private void buildAndStart(final StoreBuilder<?> 
storeBuilder,
         IntegrationTestUtils.startApplicationAndWaitUntilRunning(kafkaStreams);
     }
 
+    /**
+     * Produces a single record (no explicit timestamp) into the input stream. 
Keys and values are
+     * always {@link String}, matching the {@link StringSerializer} used below.
+     */
+    private void produce(final String key, final String value) {
+        IntegrationTestUtils.produceKeyValuesSynchronously(
+            inputStream,
+            singletonList(KeyValue.pair(key, value)),
+            TestUtils.producerConfig(CLUSTER.bootstrapServers(), 
StringSerializer.class, StringSerializer.class),
+            CLUSTER.time,
+            false);
+    }
+
+    /**
+     * Produces a single record with an explicit timestamp into the input 
stream.
+     */
+    private void produce(final String key, final String value, final long 
timestamp) {
+        IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp(
+            inputStream,
+            singletonList(KeyValue.pair(key, value)),
+            TestUtils.producerConfig(CLUSTER.bootstrapServers(), 
StringSerializer.class, StringSerializer.class),
+            timestamp,
+            false);
+    }
+
+    /**
+     * Produces a single record with an explicit timestamp and headers into 
the input stream.
+     */
+    private void produce(final String key, final String value, final long 
timestamp, final Headers headers) {
+        IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp(
+            inputStream,
+            singletonList(KeyValue.pair(key, value)),
+            TestUtils.producerConfig(CLUSTER.bootstrapServers(), 
StringSerializer.class, StringSerializer.class),
+            headers,
+            timestamp,
+            false);
+    }
+
+    /**
+     * Shared skeleton for the process-and-verify / verify helpers: waits 
until the named store is
+     * queryable and the supplied condition holds. The store lookup is retried 
until the condition
+     * passes or the timeout elapses; transient query {@link Exception}s (e.g. 
store not yet ready)
+     * are swallowed and treated as "not ready". {@link AssertionError} thrown 
by a condition that
+     * uses {@code assertX(...)} is intentionally NOT caught here, so those 
helpers still fail fast.
+     */
+    private <S> void awaitStore(final String storeName,
+                                final QueryableStoreType<S> storeType,
+                                final Predicate<S> condition,
+                                final String message) throws Exception {
+        TestUtils.waitForCondition(() -> {
+            try {
+                return condition.test(IntegrationTestUtils.getStore(storeName, 
kafkaStreams, storeType));
+            } catch (final Exception swallow) {
+                LOG.error("Error while checking store result", swallow);

Review Comment:
   Good one. Added 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to