@@ -202,6 +202,34 @@ Y_UNIT_TEST(UsedStorageV1) {
202
202
UNIT_ASSERT_VALUES_EQUAL (fullMetering, referenceStorageJson);
203
203
}
204
204
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
+
205
233
} // Y_UNIT_TEST_SUITE(MeteringSink)
206
234
207
235
} // namespace NKikimr::NPQ
0 commit comments