@@ -346,7 +346,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
346
346
347
347
Y_UNIT_TEST (TestFakeErrorPDiskManyLogWrite) {
348
348
TActorTestContext testCtx ({ false });
349
- testCtx.TestCtx .SectorMap ->ImitateIoErrorProbability = 1e-4 ;
349
+ testCtx.TestCtx .SectorMap ->IoErrorEveryNthRequests = 1000 ;
350
350
351
351
const TVDiskID vDiskID (0 , 1 , 0 , 0 , 0 );
352
352
const auto evInitRes = testCtx.TestResponse <NPDisk::TEvYardInitResult>(
@@ -355,7 +355,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
355
355
356
356
ui32 errors = 0 ;
357
357
ui32 lsn = 2 ;
358
- for (ui32 i = 0 ; i < 100 '000 ; ++i) {
358
+ for (ui32 i = 0 ; i < 10 '000 ; ++i) {
359
359
testCtx.Send (new NPDisk::TEvLog (evInitRes->PDiskParams ->Owner , evInitRes->PDiskParams ->OwnerRound , 0 ,
360
360
TRcBuf (TString (" abc" )), TLsnSeg (lsn, lsn), nullptr ));
361
361
++lsn;
@@ -384,7 +384,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
384
384
vdisk.Init ();
385
385
386
386
// Make sure there will be read error.
387
- testCtx.TestCtx .SectorMap ->ImitateReadIoErrorProbability = 1 ;
387
+ testCtx.TestCtx .SectorMap ->ReadIoErrorEveryNthRequests = 1 ;
388
388
389
389
auto res = vdisk.ReadLog (true );
390
390
@@ -404,7 +404,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
404
404
vdisk.InitFull ();
405
405
406
406
// Make sure there will be syslog read error.
407
- testCtx.TestCtx .SectorMap ->ImitateReadIoErrorProbability = 1 ;
407
+ testCtx.TestCtx .SectorMap ->ReadIoErrorEveryNthRequests = 1 ;
408
408
409
409
testCtx.TestResponse <NPDisk::TEvYardControlResult>(
410
410
new NPDisk::TEvYardControl (NPDisk::TEvYardControl::PDiskStop, nullptr ),
@@ -417,7 +417,7 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
417
417
418
418
Y_UNIT_TEST (TestFakeErrorPDiskManyChunkRead) {
419
419
TActorTestContext testCtx ({ false });
420
- testCtx.TestCtx .SectorMap ->ImitateReadIoErrorProbability = 1e-4 ;
420
+ testCtx.TestCtx .SectorMap ->ReadIoErrorEveryNthRequests = 100 ;
421
421
422
422
TVDiskMock vdisk (&testCtx);
423
423
vdisk.InitFull ();
@@ -434,7 +434,8 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
434
434
NKikimrProto::OK);
435
435
436
436
bool printed = false ;
437
- for (ui32 i = 0 ; i < 100'000 ; ++i) {
437
+ ui32 errors = 0 ;
438
+ for (ui32 i = 0 ; i < 10'000 ; ++i) {
438
439
testCtx.Send (new NPDisk::TEvChunkRead (vdisk.PDiskParams ->Owner , vdisk.PDiskParams ->OwnerRound ,
439
440
reservedChunk, 0 , 1024 , 0 , nullptr ));
440
441
@@ -445,30 +446,32 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
445
446
printed = true ;
446
447
Ctest << res->ToString () << Endl;
447
448
}
449
+ ++errors;
448
450
}
449
451
}
452
+ UNIT_ASSERT (errors > 0 );
450
453
// Check that PDisk is in working state now
451
454
vdisk.InitFull ();
452
455
}
453
456
454
457
Y_UNIT_TEST (TestFakeErrorPDiskManyChunkWrite) {
455
458
TActorTestContext testCtx ({ false });
456
- testCtx.TestCtx .SectorMap ->ImitateIoErrorProbability = 1e-4 ;
459
+ testCtx.TestCtx .SectorMap ->IoErrorEveryNthRequests = 1000 ;
457
460
458
461
const TVDiskID vDiskID (0 , 1 , 0 , 0 , 0 );
459
462
const auto evInitRes = testCtx.TestResponse <NPDisk::TEvYardInitResult>(
460
463
new NPDisk::TEvYardInit (2 , vDiskID, testCtx.TestCtx .PDiskGuid ),
461
464
NKikimrProto::OK);
462
465
463
- ui32 errors = 0 ;
464
466
const auto evReserveRes = testCtx.TestResponse <NPDisk::TEvChunkReserveResult>(
465
467
new NPDisk::TEvChunkReserve (evInitRes->PDiskParams ->Owner , evInitRes->PDiskParams ->OwnerRound , 1 ),
466
468
NKikimrProto::OK);
467
469
UNIT_ASSERT (evReserveRes->ChunkIds .size () == 1 );
468
470
const ui32 reservedChunk = evReserveRes->ChunkIds .front ();
469
471
472
+ ui32 errors = 0 ;
470
473
bool printed = false ;
471
- for (ui32 i = 0 ; i < 100 '000 ; ++i) {
474
+ for (ui32 i = 0 ; i < 10 '000 ; ++i) {
472
475
TString data = PrepareData (1024 );
473
476
testCtx.Send (new NPDisk::TEvChunkWrite (evInitRes->PDiskParams ->Owner , evInitRes->PDiskParams ->OwnerRound ,
474
477
reservedChunk, 0 , new NPDisk::TEvChunkWrite::TStrokaBackedUpParts (data), nullptr , false , 0 ));
0 commit comments