sebastienviale opened a new pull request, #22895: URL: https://github.com/apache/kafka/pull/22895
Motivation As part of KIP-1238: Multi-partition support in TopologyTestDriver. Now TopologyTestDriver keep the single task logic directly inside the class (field task, methods pipeRecord, completeAllProcessableWork, getStateStore, etc). Soon we want to add multi-partition mode, which need one task per partition instead of one task for all. If we add this directly in TopologyTestDriver, the class will have many if/else for single-partition vs multi-partition everywhere. This PR is only a refactor, no new feature. We move the task-driving logic behind a new Runtime interface, so TopologyTestDriver don't need to know how the task(s) work internally. The single-partition behavior is moved as-is, nothing change. Next PR (multi-partition) will just add a second implementation of Runtime and choose which one to use in the constructor. Changes `Runtime`: new interface for everything TopologyTestDriver need from the thing that run the task(s): `pipeRecord, advanceWallClockTime, completeAllProcessableWork, suspendAndCloseTaskCleanly, hasRecordsQueued, getStateStore`. `SinglePartitionRuntime`: new class implementing Runtime. This is just a copy-paste of what was before in TopologyTestDriver `TopologyTestDriver`: field task is removed. setupTask(...) now return the StreamTask (or null) instead of saving it directly, and the constructor use it to create a SinglePartitionRuntime. `TopologyTestDriverWrapper`: fix the one place using task.processorContext() directly, now using a new package-private method TopologyTestDriver.taskProcessorContext() instead, since task don't exist anymore on the driver. Compatibility Fully backward compatible — no behavior change and no public API change. This is a structural refactor only; the existing test suite is the only verification needed. -- 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]
