@@ -41,6 +41,8 @@ std::atomic<bool> abortSystemControllerRequested{false};
4141static size_t expectedReceptions = 0 ;
4242static size_t globalParticipantIndex = 0 ;
4343
44+ static constexpr std::chrono::seconds TEST_TIMEOUT{20 };
45+
4446std::chrono::milliseconds communicationTimeout{10000ms};
4547std::chrono::milliseconds asyncDelayBetweenPublication{50ms};
4648
@@ -256,7 +258,7 @@ class ITest_Internals_ParticipantModes : public testing::Test
256258 if (testParticipant.lifeCycleOperationMode != OperationMode::Invalid)
257259 {
258260 auto finalStateFuture = lifecycleService->StartLifecycle ();
259- finalStateFuture.get ( );
261+ finalStateFuture.wait_for (TEST_TIMEOUT );
260262 }
261263 }
262264
@@ -364,12 +366,12 @@ class ITest_Internals_ParticipantModes : public testing::Test
364366
365367 // Wait for task to have received a stop request
366368 auto simTaskFinishedFuture = testParticipant.simTaskFinishedPromise .get_future ();
367- simTaskFinishedFuture.get ( );
369+ ( void ) simTaskFinishedFuture.wait_for (TEST_TIMEOUT );
368370
369371 // Stop the lifecycle
370372 lifecycleService->Stop (" End Test" );
371373
372- finalStateFuture.get ( );
374+ ( void ) finalStateFuture.wait_for (TEST_TIMEOUT );
373375
374376 if (runTaskThread.joinable ())
375377 {
@@ -466,14 +468,14 @@ class ITest_Internals_ParticipantModes : public testing::Test
466468 };
467469 std::thread abortThread{waitForAbortTask};
468470 abortThread.detach ();
469- abortThreadDone.get_future ().get ( );
471+ abortThreadDone.get_future ().wait_for (TEST_TIMEOUT );
470472 if (abortThread.joinable ())
471473 {
472474 abortThread.join ();
473475 }
474476 abortSystemControllerRequested = false ;
475477
476- finalState.get ( );
478+ finalState.wait_for (TEST_TIMEOUT );
477479 }
478480
479481 void RunSystemController (const std::vector<std::string>& requiredParticipants)
@@ -495,7 +497,7 @@ class ITest_Internals_ParticipantModes : public testing::Test
495497 void AbortSystemController ()
496498 {
497499 abortSystemControllerRequested = true ;
498- participantThread_SystemController.shutdownFuture .get ( );
500+ participantThread_SystemController.shutdownFuture .wait_for (TEST_TIMEOUT );
499501 if (participantThread_SystemController.thread .joinable ())
500502 {
501503 participantThread_SystemController.thread .join ();
@@ -595,7 +597,7 @@ class ITest_Internals_ParticipantModes : public testing::Test
595597 {
596598 try
597599 {
598- shutdownFuture.wait ( );
600+ ( void ) shutdownFuture.wait_for (TEST_TIMEOUT );
599601 }
600602 catch (...)
601603 {
@@ -623,6 +625,8 @@ class ITest_Internals_ParticipantModes : public testing::Test
623625 {
624626 if (thread.shutdownFuture .valid ())
625627 {
628+ auto && status = thread.shutdownFuture .wait_for (TEST_TIMEOUT);
629+ ASSERT_EQ (status, std::future_status::ready); // signal failure
626630 thread.shutdownFuture .get ();
627631 }
628632 }
0 commit comments