Skip to content

KStreams PAPI test for SessionStoreWithHeaders - #4414

Open
Lucy Liu (lucliu1108) wants to merge 1 commit into
masterfrom
session-store-with-header-test
Open

KStreams PAPI test for SessionStoreWithHeaders#4414
Lucy Liu (lucliu1108) wants to merge 1 commit into
masterfrom
session-store-with-header-test

Conversation

@lucliu1108

Copy link
Copy Markdown
Member

Summary

This PR adds:

SessionStoreWithHeadersIntegrationTest, which did PAPI test on sessionStoreWithHeaders, 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 July 9, 2026 17:24
Copilot AI review requested due to automatic review settings July 9, 2026 17:24
@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.

Copilot AI left a comment

Copy link
Copy Markdown

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 Kafka Streams integration test that exercises SessionStoreWithHeaders end-to-end with header-based schema ID transport, validating various session-store operations executed from within a processor (plus IQv1 querying and changelog/restore behavior).

Changes:

  • Introduces SessionStoreWithHeadersIntegrationTest covering put/fetch/find/remove/backward/Instant variants for session stores using header-based schema IDs.
  • Adds IQv1 query verification via a custom QueryableStoreType returning AggregationWithHeaders.
  • Adds changelog tombstone-header verification and a restore-from-changelog test to ensure headers persist across rebuilds.

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

Comment on lines +89 to +91
private static final String INPUT_TOPIC = "session-input";
private static final String OUTPUT_TOPIC = "session-output";
private static final String STORE_NAME = "session-store";
Comment on lines +1087 to +1088
private static final Schema SESSION_KEY_SCHEMA = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"SessionKey\",\"namespace\":\"io.confluent.kafka.streams.integration\",\"fields\":[{\"name\":\"userId\",\"type\":\"string\"}]}");
Comment on lines +1442 to +1454
List<ConsumerRecord<GenericRecord, byte[]>> changelogRecords =
consumeRecords(changelogTopic, "session-changelog-consumer", 6, ByteArrayDeserializer.class);

int tombstoneCount = 0;
for (ConsumerRecord<GenericRecord, byte[]> record : changelogRecords) {
if (record.value() == null) {
tombstoneCount++;
Header keySchemaIdHeader = record.headers().lastHeader(SchemaId.KEY_SCHEMA_ID_HEADER);
assertNotNull(keySchemaIdHeader,
"Tombstone record should have key schema ID header");
}
}
assertTrue(tombstoneCount >= 2, "Should have at least 2 tombstone records, but found " + tombstoneCount);
Comment on lines +1586 to +1588
// Strip stale schema-id headers before the tombstone-producing put so the changelog
// tombstone isn't written with a stale value schema id attached.
private void handlePutNull(Record<GenericRecord, GenericRecord> record) {
Comment on lines +1613 to +1615
// Strip stale schema-id headers before the tombstone-producing remove so the changelog
// tombstone isn't written with a stale value schema id attached.
private void handleRemove(Record<GenericRecord, GenericRecord> record) {
@sonarqube-confluent

Copy link
Copy Markdown

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.

2 participants