Skip to content

Commit af9e821

Browse files
committed
updated the integration test with more assertions
1 parent 538a05a commit af9e821

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

storage/src/test/java/org/apache/kafka/tiered/storage/integration/ListOffsetsTest.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import static org.apache.kafka.common.utils.Utils.mkEntry;
3232
import static org.apache.kafka.common.utils.Utils.mkMap;
33+
import static org.apache.kafka.server.log.remote.storage.LocalTieredStorageEvent.EventType.DELETE_SEGMENT;
3334

3435
public class ListOffsetsTest extends TieredStorageTestHarness {
3536
@Override
@@ -94,7 +95,17 @@ protected void writeTestSpecifications(TieredStorageTestBuilder builder) {
9495
.expectListOffsets(broker1, topicA, p0, OffsetSpec.forTimestamp(timestamp + 3), new EpochEntry(Integer.MAX_VALUE, 3))
9596

9697
// delete some records and check whether the earliest_offset gets updated.
98+
.expectDeletionInRemoteStorage(broker1, topicA, p0, DELETE_SEGMENT, 1)
9799
.deleteRecords(topicA, p0, 3L)
98-
.expectListOffsets(broker1, topicA, p0, OffsetSpec.earliest(), new EpochEntry(Integer.MAX_VALUE, 3));
100+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.earliest(), new EpochEntry(Integer.MAX_VALUE, 3))
101+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.earliestLocalSpec(), new EpochEntry(Integer.MAX_VALUE, 4))
102+
103+
// delete all the records in remote layer and expect that earliest and earliest_local offsets are same
104+
.expectDeletionInRemoteStorage(broker1, topicA, p0, DELETE_SEGMENT, 1)
105+
.deleteRecords(topicA, p0, 4L)
106+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.earliest(), new EpochEntry(Integer.MAX_VALUE, 4))
107+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.earliestLocalSpec(), new EpochEntry(Integer.MAX_VALUE, 4))
108+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.latestTierSpec(), new EpochEntry(-1, 3))
109+
.expectListOffsets(broker1, topicA, p0, OffsetSpec.latest(), new EpochEntry(Integer.MAX_VALUE, 6));
99110
}
100111
}

0 commit comments

Comments
 (0)