Skip to content

Commit 03d3a7f

Browse files
committed
Add integration tests for setting connection attempts and timeout
1 parent 69823df commit 03d3a7f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_ur_driver.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include <ur_client_library/ur/dashboard_client.h>
3434
#include <thread>
35+
#include "ur_client_library/log.h"
3536
#define private public
3637
#include <ur_client_library/ur/ur_driver.h>
3738
#include <ur_client_library/example_robot_wrapper.h>
@@ -268,6 +269,19 @@ TEST_F(UrDriverTest, read_error_code)
268269
EXPECT_TRUE(g_my_robot->dashboard_client_->commandUnlockProtectiveStop());
269270
}
270271

272+
TEST(UrDriverInitTest, setting_connection_limits_works_correctly)
273+
{
274+
UrDriverConfiguration config;
275+
config.socket_reconnect_attempts = 1;
276+
config.socket_reconnection_timeout = std::chrono::milliseconds(200);
277+
config.robot_ip = "192.168.56.100"; // That IP address should not exist on the test network
278+
config.input_recipe_file = INPUT_RECIPE;
279+
config.output_recipe_file = OUTPUT_RECIPE;
280+
config.headless_mode = g_HEADLESS;
281+
282+
EXPECT_THROW(UrDriver ur_driver(config), UrException);
283+
}
284+
271285
// TODO we should add more tests for the UrDriver class.
272286

273287
int main(int argc, char* argv[])

0 commit comments

Comments
 (0)