UniversalRobots / Universal_Robots_Client_Library

A C++ library for accessing the UR interfaces that facilitate the use of UR robotic manipulators by external applications.
Apache License 2.0
123 stars 91 forks source link

Added tests for the comm classes #129

Closed urmahp closed 1 year ago

urmahp commented 1 year ago

This add tests for

Fixed check size in bin parser, so that it works with starndard data types

Added recconection time variable to TCP socket, this will control the time in between connection attempts if the server is unavailable.

urmahp commented 1 year ago

I will have to dig into why the consumer test is failing, as it hasn't been failing locally, so I am converting this PR to a draft for now.

codecov[bot] commented 1 year ago

Codecov Report

Base: 74.59% // Head: 77.45% // Increases project coverage by +2.86% :tada:

Coverage data is based on head (58b1d84) compared to base (1853580). Patch coverage: 96.37% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #129 +/- ## ========================================== + Coverage 74.59% 77.45% +2.86% ========================================== Files 89 95 +6 Lines 3491 3939 +448 Branches 368 385 +17 ========================================== + Hits 2604 3051 +447 + Misses 668 664 -4 - Partials 219 224 +5 ``` | [Impacted Files](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots) | Coverage Δ | | |---|---|---| | [tests/test\_producer.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF9wcm9kdWNlci5jcHA=) | `91.42% <91.42%> (ø)` | | | [tests/test\_pipeline.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF9waXBlbGluZS5jcHA=) | `91.56% <91.56%> (ø)` | | | [tests/test\_tcp\_socket.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF90Y3Bfc29ja2V0LmNwcA==) | `96.21% <96.21%> (ø)` | | | [tests/test\_stream.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF9zdHJlYW0uY3Bw) | `97.29% <97.29%> (ø)` | | | [include/ur\_client\_library/comm/bin\_parser.h](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-aW5jbHVkZS91cl9jbGllbnRfbGlicmFyeS9jb21tL2Jpbl9wYXJzZXIuaA==) | `89.23% <100.00%> (+12.86%)` | :arrow_up: | | [include/ur\_client\_library/comm/tcp\_socket.h](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-aW5jbHVkZS91cl9jbGllbnRfbGlicmFyeS9jb21tL3RjcF9zb2NrZXQuaA==) | `66.66% <100.00%> (+16.66%)` | :arrow_up: | | [src/comm/tcp\_socket.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-c3JjL2NvbW0vdGNwX3NvY2tldC5jcHA=) | `85.36% <100.00%> (+14.11%)` | :arrow_up: | | [tests/test\_bin\_parser.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF9iaW5fcGFyc2VyLmNwcA==) | `100.00% <100.00%> (ø)` | | | [tests/test\_package\_serializer.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF9wYWNrYWdlX3NlcmlhbGl6ZXIuY3Bw) | `100.00% <100.00%> (ø)` | | | [...lient\_library/rtde/control\_package\_setup\_outputs.h](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-aW5jbHVkZS91cl9jbGllbnRfbGlicmFyeS9ydGRlL2NvbnRyb2xfcGFja2FnZV9zZXR1cF9vdXRwdXRzLmg=) | `50.00% <0.00%> (-25.00%)` | :arrow_down: | | ... and [13 more](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/129?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

urmahp commented 1 year ago

I found the issue. Since the consumer is running in a thread sometimes the consumer wasn't started when the message was send to the client and therefore the test failed, this has been fixed with a retry mechanism, so the message is resend to the client if the first one wasn't consumed.