Skip to content

Commit d325a44

Browse files
committed
test
1 parent 6c2275d commit d325a44

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ydb/core/persqueue/ut/metering_sink_ut.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,34 @@ Y_UNIT_TEST(UsedStorageV1) {
202202
UNIT_ASSERT_VALUES_EQUAL(fullMetering, referenceStorageJson);
203203
}
204204

205+
Y_UNIT_TEST(UnusedStorageV1) {
206+
const ui64 creationTs = 1651752943168786;
207+
const ui64 flushTs = 1651754943168786;
208+
const ui32 partitions = 7;
209+
const ui64 reservedSpace = 42_GB;
210+
211+
TMeteringSink meteringSink;
212+
meteringSink.Create(TInstant::FromValue(creationTs), {
213+
.FlushInterval = TDuration::Seconds(10),
214+
.TabletId = "tabletId",
215+
.YcCloudId = "cloudId",
216+
.YcFolderId = "folderId",
217+
.YdbDatabaseId = "databaseId",
218+
.StreamName = "streamName",
219+
.ResourceId = "streamPath",
220+
.PartitionsSize = partitions,
221+
.ReservedSpace = reservedSpace,
222+
}, {EMeteringJson::UsedStorageV1}, [&](TString json) {
223+
UNIT_FAIL("Flush should not be called");
224+
Y_UNUSED(json);
225+
});
226+
227+
const ui32 quantity = 0;
228+
229+
meteringSink.IncreaseQuantity(EMeteringJson::UsedStorageV1, quantity);
230+
meteringSink.MayFlushForcibly(TInstant::FromValue(flushTs));
231+
}
232+
205233
} // Y_UNIT_TEST_SUITE(MeteringSink)
206234

207235
} // namespace NKikimr::NPQ

0 commit comments

Comments
 (0)