KAFKA-17854 Improve tests for ReadOnlyWindowStoreStub#fetch and #backwardFetch (#17586)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Yung 2024-10-25 02:35:07 +08:00 committed by GitHub
parent 63cdb3602a
commit fc4b739578
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 9 deletions

View File

@ -362,9 +362,8 @@ public class CompositeReadOnlyWindowStoreTest {
secondUnderlying.put("b", "b", 10L);
secondUnderlying.put("c", "c", 10L);
final List<KeyValue<Windowed<String>, String>> results =
StreamsTestUtils.toList(windowStore.fetch("a", null, ofEpochMilli(0), ofEpochMilli(10)));
StreamsTestUtils.toList(windowStore.fetch("b", null, ofEpochMilli(0), ofEpochMilli(10)));
assertThat(results, equalTo(Arrays.asList(
KeyValue.pair(new Windowed<>("a", new TimeWindow(0, WINDOW_SIZE)), "a"),
KeyValue.pair(new Windowed<>("b", new TimeWindow(10, 10 + WINDOW_SIZE)), "b"),
KeyValue.pair(new Windowed<>("c", new TimeWindow(10, 10 + WINDOW_SIZE)), "c"))));
}
@ -377,11 +376,10 @@ public class CompositeReadOnlyWindowStoreTest {
secondUnderlying.put("b", "b", 10L);
secondUnderlying.put("c", "c", 10L);
final List<KeyValue<Windowed<String>, String>> results =
StreamsTestUtils.toList(windowStore.fetch(null, "c", ofEpochMilli(0), ofEpochMilli(10)));
StreamsTestUtils.toList(windowStore.fetch(null, "b", ofEpochMilli(0), ofEpochMilli(10)));
assertThat(results, equalTo(Arrays.asList(
KeyValue.pair(new Windowed<>("a", new TimeWindow(0, WINDOW_SIZE)), "a"),
KeyValue.pair(new Windowed<>("b", new TimeWindow(10, 10 + WINDOW_SIZE)), "b"),
KeyValue.pair(new Windowed<>("c", new TimeWindow(10, 10 + WINDOW_SIZE)), "c"))));
KeyValue.pair(new Windowed<>("b", new TimeWindow(10, 10 + WINDOW_SIZE)), "b"))));
}
@Test
@ -407,9 +405,8 @@ public class CompositeReadOnlyWindowStoreTest {
secondUnderlying.put("b", "b", 10L);
secondUnderlying.put("c", "c", 10L);
final List<KeyValue<Windowed<String>, String>> results =
StreamsTestUtils.toList(windowStore.backwardFetch("a", null, ofEpochMilli(0), ofEpochMilli(10)));
StreamsTestUtils.toList(windowStore.backwardFetch("b", null, ofEpochMilli(0), ofEpochMilli(10)));
assertThat(results, equalTo(Arrays.asList(
KeyValue.pair(new Windowed<>("a", new TimeWindow(0, WINDOW_SIZE)), "a"),
KeyValue.pair(new Windowed<>("c", new TimeWindow(10, 10 + WINDOW_SIZE)), "c"),
KeyValue.pair(new Windowed<>("b", new TimeWindow(10, 10 + WINDOW_SIZE)), "b"))));
}
@ -422,10 +419,9 @@ public class CompositeReadOnlyWindowStoreTest {
secondUnderlying.put("b", "b", 10L);
secondUnderlying.put("c", "c", 10L);
final List<KeyValue<Windowed<String>, String>> results =
StreamsTestUtils.toList(windowStore.backwardFetch(null, "c", ofEpochMilli(0), ofEpochMilli(10)));
StreamsTestUtils.toList(windowStore.backwardFetch(null, "b", ofEpochMilli(0), ofEpochMilli(10)));
assertThat(results, equalTo(Arrays.asList(
KeyValue.pair(new Windowed<>("a", new TimeWindow(0, WINDOW_SIZE)), "a"),
KeyValue.pair(new Windowed<>("c", new TimeWindow(10, 10 + WINDOW_SIZE)), "c"),
KeyValue.pair(new Windowed<>("b", new TimeWindow(10, 10 + WINDOW_SIZE)), "b")
)));
}