Skip to content

Commit 19cdeda

Browse files
committed
more tests
1 parent d4ed619 commit 19cdeda

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

ydb/core/persqueue/ut/ut_with_sdk/topic_ut.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,45 @@ Y_UNIT_TEST_SUITE(WithSDK) {
430430
UNIT_ASSERT_VALUES_EQUAL(0, getCommittedOffset(4));
431431
}
432432
}
433+
434+
Y_UNIT_TEST(Commit_ToNewChild_WithoutCommitToParent) {
435+
TTopicSdkTestSetup setup = CreateSetup();
436+
setup.CreateTopicWithAutoscale();
437+
438+
setup.Write("message-0-0", 0);
439+
setup.Write("message-0-1", 0);
440+
setup.Write("message-0-2", 0);
441+
442+
auto getCommittedOffset = [&](size_t partition) {
443+
auto desc = setup.DescribeConsumer();
444+
return desc.GetPartitions().at(partition).GetPartitionConsumerStats()->GetCommittedOffset();
445+
};
446+
447+
{
448+
auto r = setup.Read(TEST_TOPIC, TEST_CONSUMER, [&](auto& x) {
449+
for (auto & m: x.GetMessages()) {
450+
if (x.GetPartitionSession()->GetPartitionId() == 0 && m.GetOffset() == 1) {
451+
ui64 txId = 1006;
452+
SplitPartition(setup, ++txId, 0, "a");
453+
454+
setup.Write("message-1-0", 1);
455+
setup.Write("message-1-1", 1);
456+
setup.Write("message-1-2", 1);
457+
} else if (x.GetPartitionSession()->GetPartitionId() == 1 && m.GetOffset() == 0) {
458+
m.Commit();
459+
}
460+
}
461+
return false;
462+
});
463+
464+
Sleep(TDuration::Seconds(2));
465+
466+
UNIT_ASSERT_VALUES_EQUAL(0, getCommittedOffset(0));
467+
UNIT_ASSERT_VALUES_EQUAL(0, getCommittedOffset(1));
468+
UNIT_ASSERT_VALUES_EQUAL(0, getCommittedOffset(2));
469+
}
470+
}
471+
433472
}
434473

435474
} // namespace NKikimr

0 commit comments

Comments
 (0)