Skip to content

Commit cdade1a

Browse files
Converting all tests
1 parent 5541402 commit cdade1a

44 files changed

Lines changed: 158 additions & 183 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tests/integration/complex_monitoring/component_complex_monitoring.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ TEST(ComplexMonitoring, ComponentComplexMonitoring)
5959
std::this_thread::sleep_for(75ms);
6060
heartbeat_monitor.Heartbeat();
6161
}
62-
EXPECT_FALSE(TestRunner::exitRequested) << "Process should not be terminated yet";
62+
EXPECT_FALSE(TestRunner::g_exit_requested) << "Process should not be terminated yet";
6363
}
6464
// When heartbeats are no longer sent...
6565
}
6666

6767
int main()
6868
{
69-
TestRunner(__FILE__, TerminationBehavior::kContinue).RunTests();
69+
TestRunner::Init();
70+
TestRunner::RunTests();
7071
// Then expect kill due to recovery action (verified by state manager)
7172
while (true) // Stop reporting, wait for sigkill
7273
{

‎tests/integration/complex_monitoring/control_client_test_driver.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ TEST(ComplexMonitoring, ControlClientTestDriver)
7979
// did not just send an event without taking the action.
8080
EXPECT_TRUE(std::filesystem::exists(fallback_file)) << "Fallback Run Target was not activated";
8181
}
82-
83-
TEST_STEP("Activate Off Run Target")
84-
{
85-
const auto result = client->activate_run_target("Off", true);
86-
EXPECT_TRUE(result.has_value()) << result.error().Message();
87-
}
8882
}
8983

9084
int main()
9185
{
92-
return TestRunner(__FILE__, TerminationBehavior::kWait, TerminationNotification::kTestEnd).RunTests();
86+
TestRunner::Init();
87+
const auto result = TestRunner::RunTests();
88+
TestRunner::EndTest();
89+
TestRunner::WaitForTermination();
90+
return result;
9391
}

‎tests/integration/crash_ignores_dependents/process_crashing_once.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ TEST(CrashIgnoresDependents, CrashingProcess)
4646

4747
int main()
4848
{
49-
TestRunner(__FILE__, TerminationBehavior::kContinue).RunTests();
49+
TestRunner::Init();
50+
TestRunner::RunTests();
5051
}

‎tests/integration/crash_ignores_dependents/test_process.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@ TEST(CrashIgnoresDependents, TestProcess)
5252

5353
int main()
5454
{
55-
return TestRunner(__FILE__, TerminationBehavior::kContinue, TerminationNotification::kTestEnd).RunTests();
55+
TestRunner::Init();
56+
const auto result = TestRunner::RunTests();
57+
TestRunner::EndTest();
58+
return result;
5659
}

‎tests/integration/crash_on_startup/control_client_test_driver.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,13 @@ TEST(CrashOnStartup, ControlClientTestDriver)
100100
// did not just send an event without taking the action.
101101
EXPECT_TRUE(std::filesystem::exists(fallback_file)) << "Fallback Run Target should have been activated";
102102
}
103-
104-
TEST_STEP("Activate Run Target Off")
105-
{
106-
const auto result = client->activate_run_target("Off", true);
107-
EXPECT_TRUE(result.has_value()) << result.error().Message();
108-
}
109103
}
110104

111105
int main()
112106
{
113-
return TestRunner(__FILE__, TerminationBehavior::kWait, TerminationNotification::kTestEnd).RunTests();
107+
TestRunner::Init();
108+
const auto result = TestRunner::RunTests();
109+
TestRunner::EndTest();
110+
TestRunner::WaitForTermination();
111+
return result;
114112
}

‎tests/integration/explicit_fallback_request/control_client_test_driver.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ TEST(ExplicitFallbackRequest, ControlClientTestDriver)
6262
EXPECT_EQ(target, "fallback_run_target");
6363
}
6464
});
65-
66-
TEST_STEP("Activate Run Target Off")
67-
{
68-
const auto result = client->activate_run_target("Off", true);
69-
EXPECT_TRUE(result.has_value()) << result.error().Message();
70-
}
7165
}
7266

7367
int main()
7468
{
75-
return TestRunner(__FILE__, TerminationBehavior::kWait, TerminationNotification::kTestEnd).RunTests();
69+
TestRunner::Init();
70+
const auto result = TestRunner::RunTests();
71+
TestRunner::EndTest();
72+
TestRunner::WaitForTermination();
73+
return result;
7674
}

‎tests/integration/fallback_to_same_target_restarts/control_client_test_driver.cpp‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@ TEST(FallbackToSameTargetRestarts, ControlClientTestDriver)
8686
{
8787
EXPECT_TRUE(std::filesystem::exists(process_file)) << "Process did not restart successfully";
8888
}
89-
90-
TEST_STEP("Activate Run Target Off")
91-
{
92-
const auto result = client->activate_run_target("Off", true);
93-
EXPECT_TRUE(result.has_value()) << result.error().Message();
94-
}
9589
}
9690

9791
int main()
9892
{
99-
return TestRunner(__FILE__, TerminationBehavior::kWait, TerminationNotification::kTestEnd).RunTests();
93+
TestRunner::Init();
94+
const auto result = TestRunner::RunTests();
95+
TestRunner::EndTest();
96+
TestRunner::WaitForTermination();
97+
return result;
10098
}

‎tests/integration/fallback_to_same_target_restarts/process_crashing_once.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ TEST(FallbackToSameTargetRestarts, CrashingProcess)
5757

5858
int main()
5959
{
60-
TestRunner(__FILE__, TerminationBehavior::kContinue).RunTests();
60+
TestRunner::Init();
61+
TestRunner::RunTests();
6162
}

‎tests/integration/incorrect_config_non_reporting/non_reporting_process.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,8 @@ TEST(NonReporting, Process)
4747

4848
int main()
4949
{
50-
return TestRunner(__FILE__, TerminationBehavior::kContinue, TerminationNotification::kTestEnd).RunTests();
50+
TestRunner::Init();
51+
const auto result = TestRunner::RunTests();
52+
TestRunner::EndTest();
53+
return result;
5154
}

‎tests/integration/lm_shutdown_during_rt_switch/component_c.cpp‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ TEST(LmShutdownDuringRtSwitch, ComponentC)
3434
score::mw::lifecycle::report_running();
3535
}
3636

37-
while (!TestRunner::exitRequested)
38-
{
39-
pause();
40-
}
37+
TestRunner::WaitForTermination();
4138
}
4239

4340
int main()
4441
{
45-
return TestRunner(__FILE__).RunTests();
42+
TestRunner::Init();
43+
return TestRunner::RunTests();
4644
}

0 commit comments

Comments
 (0)