Skip to content

Commit

Permalink
system_tests: don't wait for timeouts
Browse files Browse the repository at this point in the history
This only slows down testing. Blame the API that we can't properly test
the failure case.
  • Loading branch information
julianoes committed Apr 17, 2022
1 parent c966fe0 commit e041252
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/system_tests/param_custom_set_and_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ TEST(SystemTest, ParamCustomSetAndGet)
mavsdk_groundstation.set_configuration(
Mavsdk::Configuration{Mavsdk::Configuration::UsageType::GroundStation});

// We reduce the timeout for this test because some tests just trigger a timeout
// and we don't want to wait forever.
mavsdk_groundstation.set_timeout_s(0.1);

Mavsdk mavsdk_autopilot;
mavsdk_autopilot.set_configuration(
Mavsdk::Configuration{Mavsdk::Configuration::UsageType::Autopilot});
Expand Down Expand Up @@ -69,7 +65,7 @@ TEST(SystemTest, ParamCustomSetAndGet)
auto result = param.set_param_custom(param_name, data_shorter);
EXPECT_EQ(result, Param::Result::Success);

//// Check if it has been changed correctly
// Check if it has been changed correctly
result_pair = param.get_param_custom(param_name);
EXPECT_EQ(result_pair.first, Param::Result::Success);
EXPECT_EQ(result_pair.second, data_shorter);
Expand Down
15 changes: 6 additions & 9 deletions src/system_tests/param_set_and_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ TEST(SystemTest, ParamSetAndGet)
mavsdk_groundstation.set_configuration(
Mavsdk::Configuration{Mavsdk::Configuration::UsageType::GroundStation});

// We reduce the timeout for this test because some tests just trigger a timeout
// and we don't want to wait forever.
mavsdk_groundstation.set_timeout_s(0.1);

Mavsdk mavsdk_autopilot;
mavsdk_autopilot.set_configuration(
Mavsdk::Configuration{Mavsdk::Configuration::UsageType::Autopilot});
Expand All @@ -42,10 +38,11 @@ TEST(SystemTest, ParamSetAndGet)
auto param = Param{system};

// First we try to get a param before it is available.
auto result_pair = param.get_param_float(param_name_float);
EXPECT_EQ(result_pair.first, Param::Result::Timeout);
result_pair = param.get_param_int(param_name_int);
EXPECT_EQ(result_pair.first, Param::Result::Timeout);
// Disabled for now because the timeouts make it very slow to run.
// auto result_pair = param.get_param_float(param_name_float);
// EXPECT_EQ(result_pair.first, Param::Result::Timeout);
// result_pair = param.get_param_int(param_name_int);
// EXPECT_EQ(result_pair.first, Param::Result::Timeout);

// Then we make it available.
EXPECT_EQ(
Expand All @@ -56,7 +53,7 @@ TEST(SystemTest, ParamSetAndGet)
ParamServer::Result::Success);

// Now it should be available
result_pair = param.get_param_float(param_name_float);
auto result_pair = param.get_param_float(param_name_float);
EXPECT_EQ(result_pair.first, Param::Result::Success);
EXPECT_EQ(result_pair.second, param_value_float);

Expand Down

0 comments on commit e041252

Please sign in to comment.