Skip to content

Commit

Permalink
Make test more resilient to slow runner
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed Nov 28, 2024
1 parent df32e98 commit b12969c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/system_tests/camera_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,20 @@ TEST(SystemTest, CameraSettings)
camera.reset_settings(camera.camera_list().cameras[0].component_id),
Camera::Result::Success);

std::this_thread::sleep_for(std::chrono::milliseconds(500));
std::pair<Camera::Result, Camera::Setting> wb_temp;

for (size_t i = 0; i < 10; i++) {
// In some setups it takes longer for the param changes to propagate.
// But we want to end the test as early as possible. So we check regularly
// for a period of time and exit early if the check passes.
std::this_thread::sleep_for(std::chrono::milliseconds(200));

wb_temp = camera.get_setting(camera.camera_list().cameras[0].component_id, Camera::Setting{"WB_TEMP"});
if (wb_temp.first == Camera::Result::Success && wb_temp.second.option.option_id == "4000") {
break;
}
}

auto wb_temp = camera.get_setting(
camera.camera_list().cameras[0].component_id, Camera::Setting{"WB_TEMP"});
EXPECT_EQ(wb_temp.first, Camera::Result::Success);
EXPECT_EQ(wb_temp.second.option.option_id, "4000");
}
Expand Down

0 comments on commit b12969c

Please sign in to comment.