@@ -310,6 +310,15 @@ class TPartitionFixture : public NUnitTest::TBaseFixture {
310
310
void WaitForWriteError (ui64 cookie, NPersQueue::NErrorCode::EErrorCode errorCode);
311
311
void WaitForDeletePartitionDone ();
312
312
313
+ void SendCalcPredicate (ui64 step,
314
+ ui64 txId,
315
+ const TActorId& suppPartitionId);
316
+ void WaitForGetWriteInfoRequest ();
317
+ void SendGetWriteInfoError (ui32 internalPartitionId,
318
+ TString message,
319
+ const TActorId& suppPartitionId);
320
+ void WaitForCalcPredicateResult (ui64 txId, bool predicate);
321
+
313
322
TMaybe<TTestContext> Ctx;
314
323
TMaybe<TFinalizer> Finalizer;
315
324
@@ -2500,6 +2509,47 @@ void TPartitionFixture::CmdChangeOwner(ui64 cookie, const TString& sourceId, TDu
2500
2509
ownerCookie = event->Response ->GetPartitionResponse ().GetCmdGetOwnershipResult ().GetOwnerCookie ();
2501
2510
}
2502
2511
2512
+ void TPartitionFixture::SendCalcPredicate (ui64 step,
2513
+ ui64 txId,
2514
+ const TActorId& suppPartitionId)
2515
+ {
2516
+ SendCalcPredicate (step, txId, " " , 0 , 0 , suppPartitionId);
2517
+ }
2518
+
2519
+ void TPartitionFixture::WaitForGetWriteInfoRequest ()
2520
+ {
2521
+ auto event = Ctx->Runtime ->GrabEdgeEvent <TEvPQ::TEvGetWriteInfoRequest>();
2522
+ UNIT_ASSERT (event != nullptr );
2523
+ // UNIT_ASSERT_VALUES_EQUAL(event->OriginalPartition, ActorId);
2524
+ }
2525
+
2526
+ void TPartitionFixture::SendGetWriteInfoError (ui32 internalPartitionId,
2527
+ TString message,
2528
+ const TActorId& suppPartitionId)
2529
+ {
2530
+ auto event = MakeHolder<TEvPQ::TEvGetWriteInfoError>(internalPartitionId,
2531
+ std::move (message));
2532
+ // event->SupportivePartition = suppPartitionId;
2533
+
2534
+ Ctx->Runtime ->SingleSys ()->Send (new IEventHandle (ActorId, suppPartitionId, event.Release ()));
2535
+ }
2536
+
2537
+ void TPartitionFixture::WaitForCalcPredicateResult (ui64 txId, bool predicate)
2538
+ {
2539
+ while (true ) {
2540
+ TAutoPtr<IEventHandle> handle;
2541
+ auto events =
2542
+ Ctx->Runtime ->GrabEdgeEvents <TEvPQ::TEvTxCalcPredicateResult, TEvKeyValue::TEvRequest>(handle,
2543
+ TDuration::Seconds (1 ));
2544
+ if (std::get<TEvKeyValue::TEvRequest*>(events)) {
2545
+ SendDiskStatusResponse (nullptr );
2546
+ } else if (auto * event = std::get<TEvPQ::TEvTxCalcPredicateResult*>(events)) {
2547
+ UNIT_ASSERT_VALUES_EQUAL (event->TxId , txId);
2548
+ UNIT_ASSERT_VALUES_EQUAL (event->Predicate , predicate);
2549
+ break ;
2550
+ }
2551
+ }
2552
+ }
2503
2553
2504
2554
Y_UNIT_TEST_F (ReserveSubDomainOutOfSpace, TPartitionFixture)
2505
2555
{
@@ -3602,6 +3652,20 @@ Y_UNIT_TEST_F(The_DeletePartition_Message_Arrives_Before_The_ApproveWriteQuota_M
3602
3652
WaitForWriteError (2 , NPersQueue::NErrorCode::ERROR);
3603
3653
}
3604
3654
3655
+ Y_UNIT_TEST_F (After_TEvGetWriteInfoError_Comes_TEvTxCalcPredicateResult, TPartitionFixture)
3656
+ {
3657
+ const TPartitionId partitionId{1 };
3658
+ const ui64 step = 12345 ;
3659
+ const ui64 txId = 67890 ;
3660
+
3661
+ CreatePartition ({.Partition =partitionId});
3662
+
3663
+ SendCalcPredicate (step, txId, Ctx->Edge );
3664
+ WaitForGetWriteInfoRequest ();
3665
+ SendGetWriteInfoError (31415 , " error" , Ctx->Edge );
3666
+ WaitForCalcPredicateResult (txId, false );
3667
+ }
3668
+
3605
3669
} // End of suite
3606
3670
3607
3671
} // namespace
0 commit comments