|
33 | 33 | #include <condition_variable> |
34 | 34 | #include <cstddef> |
35 | 35 |
|
| 36 | +// This file adds a test for a deprecated function. To avoid a compiler warning in CI (where we want |
| 37 | +// to treat warnings as errors) we suppress the warning inside this file. |
| 38 | +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
36 | 39 | #include <ur_client_library/comm/tcp_socket.h> |
37 | 40 | #include <ur_client_library/comm/tcp_server.h> |
38 | 41 | #include "ur_client_library/types.h" |
@@ -156,7 +159,7 @@ class TCPSocketTest : public ::testing::Test |
156 | 159 | std::chrono::milliseconds reconnection_time = std::chrono::seconds(10)) |
157 | 160 | { |
158 | 161 | std::string ip = "127.0.0.1"; |
159 | | - TCPSocket::setup(ip, port); |
| 162 | + TCPSocket::setup(ip, port, max_num_tries, reconnection_time); |
160 | 163 | done_setting_up_client_ = true; |
161 | 164 | } |
162 | 165 | }; |
@@ -349,7 +352,18 @@ TEST_F(TCPSocketTest, setup_while_client_is_connected) |
349 | 352 | TEST_F(TCPSocketTest, connect_non_running_robot) |
350 | 353 | { |
351 | 354 | Client client(12321, "127.0.0.1"); |
| 355 | + auto start = std::chrono::system_clock::now(); |
352 | 356 | EXPECT_FALSE(client.setup(2, std::chrono::milliseconds(500))); |
| 357 | + auto end = std::chrono::system_clock::now(); |
| 358 | + auto elapsed = end - start; |
| 359 | + // This is only a rough estimate, obviously |
| 360 | + EXPECT_LT(elapsed, std::chrono::milliseconds(1500)); |
| 361 | +} |
| 362 | + |
| 363 | +TEST_F(TCPSocketTest, test_deprecated_reconnection_time_interface) |
| 364 | +{ |
| 365 | + client_->setReconnectionTime(std::chrono::milliseconds(100)); |
| 366 | + EXPECT_TRUE(client_->setup(2)); |
353 | 367 | } |
354 | 368 |
|
355 | 369 | int main(int argc, char* argv[]) |
|
0 commit comments