-
Notifications
You must be signed in to change notification settings - Fork 732
test for invalid reassign #28404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test for invalid reassign #28404
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8229,6 +8229,69 @@ Y_UNIT_TEST_SUITE(THiveTest) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Y_UNIT_TEST(TestReassignNonexistentTablet) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TTestBasicRuntime runtime(1, false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Setup(runtime, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const ui64 hiveTablet = MakeDefaultHiveID(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const ui64 testerTablet = MakeTabletID(false, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const TActorId hiveActor = CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::Hive), &CreateDefaultHive); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime.EnableScheduleForActor(hiveActor); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MakeSureTabletIsUp(runtime, hiveTablet, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TActorId sender = runtime.AllocateEdgeActor(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TDispatchOptions options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options.FinalEvents.emplace_back(TEvLocal::EvSyncTablets); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime.DispatchEvents(options); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| THolder<TEvHive::TEvCreateTablet> createTablet = MakeHolder<TEvHive::TEvCreateTablet>(testerTablet, 1, TTabletTypes::Dummy, BINDED_CHANNELS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ui64 tablet = SendCreateTestTablet(runtime, hiveTablet, testerTablet, std::move(createTablet), 0, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MakeSureTabletIsUp(runtime, tablet, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NActorsProto::TRemoteHttpInfo pb; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pb.SetMethod(HTTP_METHOD_POST); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pb.SetPath("/app"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto* p1 = pb.AddQueryParams(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p1->SetKey("TabletID"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p1->SetValue(TStringBuilder() << hiveTablet); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto* p2 = pb.AddQueryParams(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p2->SetKey("page"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p2->SetValue("ReassignTablet"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto* p3 = pb.AddQueryParams(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p3->SetKey("tablet"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p3->SetValue("52"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime.SendToPipe(hiveTablet, sender, new NMon::TEvRemoteHttpInfo(std::move(pb)), 0, GetPipeConfigWithRetries()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TAutoPtr<IEventHandle> handle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto resp = runtime.GrabEdgeEventRethrow<NMon::TEvRemoteJsonInfoRes>(handle); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ctest << "Hive response: " << resp->Json << Endl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NJson::TJsonValue value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ReadJsonTree(resp->Json, &value, false); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UNIT_ASSERT_VALUES_EQUAL(value["total"].GetIntegerSafe(), 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // this must not block balancer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metric->SetTabletID(tablet); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metric->MutableResourceUsage()->SetNetwork(9000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8279
to
+8286
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this closing brace uses 7 spaces instead of 8 spaces like the rest of the function. Should align with the corresponding opening brace.
| } | |
| } |
Copilot
AI
Nov 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this block uses 7 spaces instead of 8 spaces like the rest of the function. All lines in this block should be indented with 8 spaces to match the rest of the test function.
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| TDispatchOptions options; | |
| options.FinalEvents.push_back(NHive::TEvPrivate::EvBalancerOut); | |
| runtime.DispatchEvents(options); | |
| } | |
| { | |
| THolder<TEvHive::TEvTabletMetrics> metrics = MakeHolder<TEvHive::TEvTabletMetrics>(); | |
| NKikimrHive::TTabletMetrics* metric = metrics->Record.AddTabletMetrics(); | |
| metric->SetTabletID(tablet); | |
| metric->MutableResourceUsage()->SetNetwork(9000); | |
| runtime.SendToPipe(hiveTablet, sender, metrics.Release()); | |
| } | |
| { | |
| TDispatchOptions options; | |
| options.FinalEvents.push_back(NHive::TEvPrivate::EvBalancerOut); | |
| runtime.DispatchEvents(options); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded tablet ID "52" could potentially collide with an existing tablet. Consider using a clearly non-existent ID similar to line 8214 (e.g.,
TStringBuilder() << 0xfa5e7ab1e7) or adding a comment explaining why this specific value is guaranteed to be non-existent.