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


##########
streams/integration-tests/src/test/java/org/apache/kafka/streams/integration/HeadersStoreUpgradeIntegrationTest.java:
##########
@@ -1586,146 +1371,57 @@ public void 
shouldSuccessfullyDowngradeFromSessionStoreWithHeadersToSessionStore
     private void processSessionKeyValueAndVerify(final String key,
                                                   final String value,
                                                   final long timestamp) throws 
Exception {
-        IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp(
-            inputStream,
-            singletonList(KeyValue.pair(key, value)),
-            TestUtils.producerConfig(CLUSTER.bootstrapServers(),
-                StringSerializer.class,
-                StringSerializer.class),
-            timestamp,
-            false);
-
-        TestUtils.waitForCondition(() -> {
-            try {
-                final ReadOnlySessionStore<String, String> store =
-                    IntegrationTestUtils.getStore(SESSION_STORE_NAME, 
kafkaStreams, QueryableStoreTypes.sessionStore());
-
-                if (store == null) {
-                    return false;
-                }
+        produce(key, value, timestamp);
 
-                try (final KeyValueIterator<Windowed<String>, String> iterator 
= store.fetch(key)) {
-                    while (iterator.hasNext()) {
-                        final KeyValue<Windowed<String>, String> kv = 
iterator.next();
-                        if (kv.key.key().equals(key) && 
kv.value.equals(value)) {
-                            return true;
-                        }
-                    }
-                }
-                return false;
-            } catch (final Exception e) {
-                return false;
-            }
-        }, 60_000L, "Could not verify session value in time.");
+        awaitStore(SESSION_STORE_NAME, QueryableStoreTypes.<String, 
String>sessionStore(),
+            store -> {
+                final Optional<KeyValue<Windowed<String>, String>> result = 
findSessionValue(store, key, timestamp);
+                return result.isPresent() && value.equals(result.get().value);
+            },
+            "Could not verify session value in time.");
     }
 
     private void verifySessionValueWithEmptyHeaders(final String key,
                                                     final String value,
                                                     final long timestamp) 
throws Exception {
-        TestUtils.waitForCondition(() -> {
-            try {
-                final ReadOnlySessionStore<String, 
AggregationWithHeaders<String>> store =
-                    IntegrationTestUtils.getStore(SESSION_STORE_NAME, 
kafkaStreams, QueryableStoreTypes.sessionStoreWithHeaders());
-
-                if (store == null) {
+        awaitStore(SESSION_STORE_NAME, QueryableStoreTypes.<String, 
String>sessionStoreWithHeaders(),

Review Comment:
   Done. Added verifySessionValue(key, value, timestamp, expectedHeaders).



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