diff options
| author | serg-belyakov <[email protected]> | 2023-07-21 18:33:08 +0300 |
|---|---|---|
| committer | serg-belyakov <[email protected]> | 2023-07-21 18:33:08 +0300 |
| commit | 7ec327a014cc13cd295f4691a17ae02bab78e70d (patch) | |
| tree | 14d152662e20e4afc16bec5e41f585da3890bf36 | |
| parent | b49036f50786aa205e65e78fa2dcff43d14490a2 (diff) | |
Test suppress version check, KIKIMR-18776
Add suppress version check UT
| -rw-r--r-- | ydb/core/actorlib_impl/test_interconnect_ut.cpp | 91 |
1 files changed, 59 insertions, 32 deletions
diff --git a/ydb/core/actorlib_impl/test_interconnect_ut.cpp b/ydb/core/actorlib_impl/test_interconnect_ut.cpp index 53fef9b9f9c..854c668c21a 100644 --- a/ydb/core/actorlib_impl/test_interconnect_ut.cpp +++ b/ydb/core/actorlib_impl/test_interconnect_ut.cpp @@ -783,7 +783,7 @@ Y_UNIT_TEST_SUITE(TInterconnectTest) { TestConnectionWithDifferentVersions(node1, node0); } - Y_UNIT_TEST(OldFormat) { + void TestOldFormat(TString oldTag, bool suppressOnNew, bool suppressOnOld) { std::shared_ptr<NKikimrConfig::TCurrentCompatibilityInfo> node0 = std::make_shared<NKikimrConfig::TCurrentCompatibilityInfo>(); { @@ -812,48 +812,75 @@ Y_UNIT_TEST_SUITE(TInterconnectTest) { runtime.SetUseRealInterconnect(); runtime.SetICCommonSetupper([=](ui32 nodeNum, TIntrusivePtr<TInterconnectProxyCommon> common) { if (nodeNum % 2 == 0) { - common->CompatibilityInfo = TString(); - - common->ValidateCompatibilityInfo = - [=](const TString& peer, TString& errorReason) { - NKikimrConfig::TStoredCompatibilityInfo peerPB; - if (!peerPB.ParseFromString(peer)) { - errorReason = "Cannot parse given CompatibilityInfo"; - return false; - } - - return TCompatibilityInfo::CheckCompatibility(node0.get(), &peerPB, - NKikimrConfig::TCompatibilityRule::Interconnect, errorReason); - }; - - common->ValidateCompatibilityOldFormat = - [=](const TMaybe<TInterconnectProxyCommon::TVersionInfo>& peer, TString& errorReason) { - if (!peer) { - return true; - } - return TCompatibilityInfo::CheckCompatibility(node0.get(), *peer, - NKikimrConfig::TCompatibilityRule::Interconnect, errorReason); + if (!suppressOnNew) { + common->CompatibilityInfo.emplace(); + + common->ValidateCompatibilityInfo = + [=](const TString& peer, TString& errorReason) { + NKikimrConfig::TStoredCompatibilityInfo peerPB; + if (!peerPB.ParseFromString(peer)) { + errorReason = "Cannot parse given CompatibilityInfo"; + return false; + } + + return TCompatibilityInfo::CheckCompatibility(node0.get(), &peerPB, + NKikimrConfig::TCompatibilityRule::Interconnect, errorReason); + }; + + common->ValidateCompatibilityOldFormat = + [=](const TMaybe<TInterconnectProxyCommon::TVersionInfo>& peer, TString& errorReason) { + if (!peer) { + return true; + } + return TCompatibilityInfo::CheckCompatibility(node0.get(), *peer, + NKikimrConfig::TCompatibilityRule::Interconnect, errorReason); + }; + + common->VersionInfo = TInterconnectProxyCommon::TVersionInfo{ + .Tag = "stable-23-1", + .AcceptedTags = { "stable-23-1", "stable-22-5" }, }; + } } else { - common->VersionInfo = TInterconnectProxyCommon::TVersionInfo{ - .Tag = "stable-22-5-6-hotfix-1", - .AcceptedTags = {"stable-22-5-6-hotfix-1"} - }; + if (!suppressOnOld) { + common->VersionInfo = TInterconnectProxyCommon::TVersionInfo{ + .Tag = oldTag, + .AcceptedTags = { oldTag } + }; + } } }); runtime.Initialize(TAppPrepare().Unwrap()); - const auto edge = runtime.AllocateEdgeActor(0); - runtime.Send(new IEventHandle(runtime.GetInterconnectProxy(0, 1), edge, new TEvInterconnect::TEvConnectNode), 0, true); + using TPair = std::pair<ui32, ui32>; + for (auto [node1, node2] : {TPair{0, 1}, TPair{1, 0}}) { + const auto edge = runtime.AllocateEdgeActor(node1); + runtime.Send(new IEventHandle(runtime.GetInterconnectProxy(node1, node2), edge, new TEvInterconnect::TEvConnectNode), node1, true); - TAutoPtr<IEventHandle> handle; - { - const auto event = runtime.GrabEdgeEvent<TEvInterconnect::TEvNodeConnected>(handle); - UNIT_ASSERT_EQUAL(event->NodeId, runtime.GetNodeId(1)); + TAutoPtr<IEventHandle> handle; + { + const auto event = runtime.GrabEdgeEvent<TEvInterconnect::TEvNodeConnected>(handle); + UNIT_ASSERT_EQUAL(event->NodeId, runtime.GetNodeId(node2)); + } } } + Y_UNIT_TEST(OldFormat) { + TestOldFormat("stable-22-5", false, false); + } + + Y_UNIT_TEST(OldFormatSuppressVersionCheckOnNew) { + TestOldFormat("trunk", true, false); + } + + Y_UNIT_TEST(OldFormatSuppressVersionCheckOnOld) { + TestOldFormat("trunk", false, true); + } + + Y_UNIT_TEST(OldFormatSuppressVersionCheck) { + TestOldFormat("trunk", true, true); + } } } |
