Skip to content

KStreams PAPI test for TimestampedWindowStoreWithHeaders#4212

Open
Lucy Liu (lucliu1108) wants to merge 3 commits intoconfluentinc:masterfrom
lucliu1108:timestamped-windowed-store-header-test
Open

KStreams PAPI test for TimestampedWindowStoreWithHeaders#4212
Lucy Liu (lucliu1108) wants to merge 3 commits intoconfluentinc:masterfrom
lucliu1108:timestamped-windowed-store-header-test

Conversation

@lucliu1108
Copy link
Copy Markdown
Member

@lucliu1108 Lucy Liu (lucliu1108) commented Mar 20, 2026

Summary

This PR adds:

  1. TimestampedWindowStoreWithHeadersIntegrationTest, which did PAPI test on timestampedWindowStoreWithHeaders, and validate store operations in the processor.

What

Checklist

Please answer the questions with Y, N or N/A if not applicable.

  • [ ] Contains customer facing changes? Including API/behavior changes
  • [ ] Is this change gated behind config(s)?
    • List the config(s) needed to be set to enable this change
  • [ ] Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required
  • [ ] Does this change require modifying existing system tests or adding new system tests?
    • If so, include tracking information for the system test changes
  • [ ] Must this be released together with other change(s), either in this repo or another one?
    • If so, please include the link(s) to the changes that must be released together

References

JIRA:

Test & Review

Open questions / Follow-ups

@lucliu1108 Lucy Liu (lucliu1108) requested a review from a team as a code owner March 20, 2026 15:08
Copilot AI review requested due to automatic review settings March 20, 2026 15:08
@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Streams integration test class to validate TimestampedWindowStoreWithHeaders behavior (including header-based schema ID transport) across a variety of store operations and query paths.

Changes:

  • Introduces TimestampedWindowStoreWithHeadersIntegrationTest covering PAPI-style store ops, IQv1 querying, delete/tombstone behavior, and iterator method behavior.
  • Adds helper utilities for topic creation, Streams lifecycle, producing/consuming records, and schema-id header assertions.
  • Fixes trailing indentation/formatting at the end of streams-integration-tests/pom.xml.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 10 comments.

File Description
streams-integration-tests/src/test/java/io/confluent/kafka/streams/integration/TimestampedWindowStoreWithHeadersIntegrationTest.java New, comprehensive integration test suite for window-store-with-headers operations and IQ querying.
streams-integration-tests/pom.xml Minor formatting change (project closing tag alignment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"Tombstone record should have key schema ID header");
}
}
System.out.println("Tombstone count: " + tombstoneCount);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Avoid printing to stdout from tests. This adds noise to CI logs and can hide relevant output; if you need diagnostics, use assertions/messages or a test logger that can be enabled when debugging.

Suggested change
System.out.println("Tombstone count: " + tombstoneCount);

Copilot uses AI. Check for mistakes.
Comment on lines +1452 to +1453
assertTrue(startedLatch.await(30, TimeUnit.SECONDS), "KafkaStreams should reach RUNNING state");
return streams;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

If the RUNNING-state await times out, startStreamsAndAwaitRunning throws an AssertionError after starting KafkaStreams, but the instance is never closed (call site won't assign it due to the exception). Consider closing streams before failing (e.g., in a try/finally around the await) to avoid thread/resource leaks and noisy CI failures when the startup is flaky.

Suggested change
assertTrue(startedLatch.await(30, TimeUnit.SECONDS), "KafkaStreams should reach RUNNING state");
return streams;
boolean running = false;
try {
running = startedLatch.await(30, TimeUnit.SECONDS);
assertTrue(running, "KafkaStreams should reach RUNNING state");
return streams;
} finally {
if (!running) {
closeStreams(streams);
}
}

Copilot uses AI. Check for mistakes.
@lucliu1108 Lucy Liu (lucliu1108) force-pushed the timestamped-windowed-store-header-test branch from 86f9cf8 to fb6a067 Compare March 20, 2026 15:42
Copy link
Copy Markdown
Member

@frankvicky TengYao Chi (frankvicky) left a comment

Choose a reason for hiding this comment

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

Thanks for the PR

}

/**
* Fetch range for event-2 from 6-11min (240000ms to 660000ms).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems the comment not accurate?

@Override
public void process(Record<GenericRecord, GenericRecord> record) {
String operation = record.value().get("operation").toString();
long windowStart = (record.timestamp() / WINDOW_SIZE.toMillis()) * WINDOW_SIZE.toMillis();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we have a helper method for window start/end calculation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Edit: added helper method calculateWindowStartTime to calculate window start time

}
}

private List<ConsumerRecord<GenericRecord, GenericRecord>> consumeRecords(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we need add a check when received count > expected count?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Edit: added a number check after the poll loop completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants