Skip to content

Commit

Permalink
Fix IceGrid/activation test failure - #2117 (#3396)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Jan 21, 2025
1 parent bdf764b commit 624dbf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions cpp/test/IceGrid/activation/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ void
waitForServerState(optional<IceGrid::AdminPrx> admin, std::string server, IceGrid::ServerState state)
{
int nRetry = 0;
while (admin->getServerState(server) != state && nRetry < 15)
IceGrid::ServerState currentState = admin->getServerState(server);
while (currentState != state && nRetry < 15)
{
this_thread::sleep_for(chrono::milliseconds(500));
++nRetry;
currentState = admin->getServerState(server);
}
if (admin->getServerState(server) != state)

if (currentState != state)
{
cerr << "server state change timed out:" << endl;
cerr << "server: " << server << endl;
cerr << "state: " << static_cast<int>(state) << endl;
cerr << "expected state: " << state << endl;
cerr << "current state: " << currentState << endl;
test(false);
}
}

Expand Down Expand Up @@ -610,6 +615,7 @@ allTests(Test::TestHelper* helper)
{
test(admin->getServerState("server1") == IceGrid::ServerState::Inactive);
TestIntfPrx obj(communicator, "server1");
obj->ice_ping();
waitForServerState(admin, "server1", IceGrid::ServerState::Active);
obj->fail();
waitForServerState(admin, "server1", IceGrid::ServerState::Inactive);
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/IceGrid/activation/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ main(int argc, char** argv)
}
catch (const TestActivationFailure&)
{
status = 1; // excpected failure
status = 1; // expected failure
}
catch (const std::exception& ex)
{
Expand Down

0 comments on commit 624dbf4

Please sign in to comment.