@@ -5920,7 +5920,7 @@ Y_UNIT_TEST_SUITE(THiveTest) {
5920
5920
}
5921
5921
}
5922
5922
5923
- Y_UNIT_TEST (TestFollowerCompatability1 ) {
5923
+ void TestAncientFollowers ( unsigned followerCount ) {
5924
5924
static constexpr ui32 NUM_NODES = 3 ;
5925
5925
TTestBasicRuntime runtime (NUM_NODES, NUM_NODES); // num nodes = num dcs
5926
5926
Setup (runtime, true );
@@ -5940,7 +5940,7 @@ Y_UNIT_TEST_SUITE(THiveTest) {
5940
5940
THolder<TEvHive::TEvCreateTablet> ev (new TEvHive::TEvCreateTablet (testerTablet, 100500 , tabletType, BINDED_CHANNELS));
5941
5941
ev->Record .SetObjectId (1 );
5942
5942
auto * followerGroup = ev->Record .AddFollowerGroups ();
5943
- followerGroup->SetFollowerCount (NUM_NODES );
5943
+ followerGroup->SetFollowerCount (followerCount );
5944
5944
followerGroup->SetFollowerCountPerDataCenter (false );
5945
5945
followerGroup->SetRequireAllDataCenters (true );
5946
5946
ui64 tabletId = SendCreateTestTablet (runtime, hiveTablet, testerTablet, std::move (ev), 0 , true );
@@ -5959,17 +5959,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
5959
5959
}
5960
5960
{
5961
5961
TDispatchOptions options;
5962
- options.FinalEvents .emplace_back (TEvLocal::EvTabletStatus, 3 );
5962
+ options.FinalEvents .emplace_back (TEvLocal::EvTabletStatus, followerCount );
5963
5963
runtime.DispatchEvents (options, TDuration::Seconds (1 ));
5964
5964
}
5965
- // test every node has a follower running
5966
5965
NTabletPipe::TClientConfig pipeConfig;
5967
5966
pipeConfig.ForceLocal = true ;
5968
5967
pipeConfig.AllowFollower = true ;
5969
5968
pipeConfig.ForceFollower = true ;
5969
+ unsigned actualFollowers = 0 ;
5970
5970
for (ui32 node = 0 ; node < NUM_NODES; ++node) {
5971
- MakeSureTabletIsUp (runtime, tabletId, node, &pipeConfig);
5971
+ if (CheckTabletIsUp (runtime, tabletId, node, &pipeConfig)) {
5972
+ ++actualFollowers;
5973
+ }
5972
5974
}
5975
+ UNIT_ASSERT_VALUES_EQUAL (followerCount, actualFollowers);
5976
+ }
5977
+
5978
+ Y_UNIT_TEST (TestFollowerCompatability1) {
5979
+ TestAncientFollowers (3 );
5973
5980
}
5974
5981
5975
5982
Y_UNIT_TEST (TestFollowerCompatability2) {
@@ -6033,6 +6040,10 @@ Y_UNIT_TEST_SUITE(THiveTest) {
6033
6040
UNIT_ASSERT_VALUES_EQUAL (followers, 2 );
6034
6041
}
6035
6042
6043
+ Y_UNIT_TEST (TestFollowerCompatability3) {
6044
+ TestAncientFollowers (0 );
6045
+ }
6046
+
6036
6047
Y_UNIT_TEST (TestCreateExternalTablet) {
6037
6048
TTestBasicRuntime runtime (1 , false );
6038
6049
Setup (runtime, true );
0 commit comments