Skip to content

Commit

Permalink
fix waiting in test
Browse files Browse the repository at this point in the history
  • Loading branch information
vporyadke committed Oct 18, 2024
1 parent 818fa30 commit 5a478fc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions ydb/core/mind/hive/hive_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,9 @@ Y_UNIT_TEST_SUITE(THiveTest) {
{
TDispatchOptions options;
options.FinalEvents.emplace_back(NHive::TEvPrivate::EvDeleteNode);
runtime.DispatchEvents(options, TDuration::Seconds(6));
runtime.DispatchEvents(options);
runtime.AdvanceCurrentTime(TDuration::Seconds(2));
runtime.DispatchEvents(options);
}
}

Expand Down Expand Up @@ -1157,8 +1159,19 @@ Y_UNIT_TEST_SUITE(THiveTest) {
runtime.Register(CreateTabletKiller(hiveTablet));
{
TDispatchOptions options;
options.FinalEvents.emplace_back(TEvLocal::EvStatus, NUM_NODES);
runtime.DispatchEvents(options);
std::unordered_set<ui32> nodesConnected;
auto observer = runtime.AddObserver<TEvLocal::TEvStatus>([&](auto&& ev) { nodesConnected.insert(ev->Sender.NodeId()); });
auto waitFor = [&](const auto& condition, const TString& description) {
while (!condition()) {
Ctest << "waiting for " << description << Endl;
TDispatchOptions options;
options.CustomFinalCondition = [&]() {
return condition();
};
runtime.DispatchEvents(options);
}
};
waitFor([&](){return nodesConnected.size() == NUM_NODES; }, "nodes to connect");
}

Ctest << "5. Ensure node is not down (by creating tablets)\n";
Expand Down

0 comments on commit 5a478fc

Please sign in to comment.