-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make use of ros_testing to test policy generation. #214
Conversation
Codecov Report
@@ Coverage Diff @@
## master #214 +/- ##
==========================================
+ Coverage 77.95% 78.12% +0.17%
==========================================
Files 16 16
Lines 576 576
Branches 52 52
==========================================
+ Hits 449 450 +1
+ Misses 107 106 -1
Partials 20 20
Continue to review full report at Codecov.
|
Both |
Noticed this too and confirmed that using an image with connext installed will fix the failing test: https://github.com/ros2/sros2/runs/677227888. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's great improvement thanks!
Looks great, left a couple nitpick comments inline
sros2/test/sros2/commands/security/verbs/test_generate_policy.py
Outdated
Show resolved
Hide resolved
sros2/test/sros2/commands/security/verbs/test_generate_policy.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,63 @@ | |||
# Copyright 2019 Canonical Ltd | |||
# Copyright 2020 Open Source Robotics Foundation, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File has multiple copyright statements but no history
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point. It is work derived from a source file that was originally developed by Canonical. Do tell how we should proceed with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it actually share git history with another file? Or is it more of a "I copied that file and turned it into something else" situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a modified copy of test_generate_policy.py
.
sros2/test/sros2/commands/security/verbs/utilities/sros2_cli_test_case.py
Show resolved
Hide resolved
import test_msgs.srv | ||
|
||
|
||
class ClientServiceNode(Node): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this (and other similar constructs) be turned into an actual pytest fixture on a conftest.py somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short answer is no, because test_generate_policy*.py
is no longer a pytest
, but a pytest
-run launch
test.
]) | ||
|
||
|
||
class SROS2CLITestCase(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing tests in this project are all pytest. Why are we using unittest here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because test_generate_policy*.py
is no longer a pytest
, but a pytest
-run launch
test. And launch_testing
is built on top of unittest
. There's a desire to achieve a stronger integration between launch_testing
and pytest
(even turning the former into a plugin for the latter, see ros2/launch#405), but as of today, we can only include launch
tests in pytest
runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, thank you for explaining. I really dislike mixing the two, here. It's complicated enough having both of them in existence and sharing space in my head-- having them both used in the same project will cause no end of confusion. Is there any other way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's not, assuming that testing against multiple RMW implementations is a requirement (I understand it is based on #212 (comment)) and that we're not looking forward to recreate launch
and launch_testing
using subprocess
and pytest
just for this one test. I'd rather not do that.
CI up to
|
I'm not happy with 3e1bc39, for a few different reasons. But I'm unable to reproduce Windows CI failures in a Windows VM. CC @jacobperron |
Signed-off-by: Brian Ezequiel Marchi <[email protected]> Co-authored-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
09dcdf9
to
c68f0a0
Compare
Alright, I corrected the commit history to pass DCO and make sense. CI's green, though tests are being skipped on Windows. FYI @mikaelarguedas @kyrofa. @jacobperron how shall we proceed? |
Regarding the move away from pytest and mixing unittest and pytest in the same package, I'm not a fan but it wouldn't be a blocker for me. However, the fact that this seems to have pretty consistently failed CI on this repo makes me doubt this is having the intended effect of reducing flakeyness. So IMO it can't be merged as is. I was hoping that the flakeyness was due to adding connext into the mix but several failing tests seem to be related to fastrtps(static or dynamic) so it connext doesn't seem to be the culprit. We could scale back this to just provide a single RMW with daemon and "long" discovery time. if that proves to reduce flakeyness I'm in favor of merging that as it'll keep covering the cases users will face when using the CLI while improving CI stability. |
I have to circle back and see what's happening with Fast-RTPS now. In all cases, however, the issue (it seems) remains to be discovery latency. Testing with and without a daemon and against multiple RMW implementations only made it more visible. I agree that to merge as-is isn't viable. I'm not sure I'd test less either just to get jobs to pass. Maybe we need to start ensuring preconditions (in this case, ROS graph state) hold instead of hoping they will within an arbitrary timeout. |
This reverts commit c68f0a0. Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
One last try with 1a15522. |
Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
Signed-off-by: Michel Hidalgo <[email protected]>
Had to bump up the timeout for |
Signed-off-by: Michel Hidalgo <[email protected]>
Ok, b2a8bcb is almost insane. Those that timeout are the ones that use the daemon, and so they have the added overhead of XMLRPC calls. Still, it's ridiculous. |
CI up to @mikaelarguedas @kyrofa PTAL, I think I've managed to remove most flakiness sources. I'm a bit baffled though by the time it takes the verb to complete in Windows. |
This seems indeed incredible that it takes more than 20seconds to get the accurate state of a graph with 1 node and one Publisher/Subscriber pair... Is the same happening for other tests doing similar things ? or is there something wrong with the way testing is done here ?
As far as CI goes on this repo the latest iterations of this PR seem to yield only green jobs which is a big improvement compared to last review 👍 |
I think almost all CLI tests are disabled on Windows due to ros2/build_farmer#248. At any rate, as I mentioned in #214 (comment), I do see |
I missed that bit. This seems very long too.. On linux its more on the second scale. I'm +1 for this change as it increases use cases covered, does not degrade CI here and (IIUC) decreases CI flakyness on ci.ros2.org. I'll leave it up to @kyrofa for the second review |
@kyrofa friendly ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, while this makes me a bit grumpy (in the nicest possible sense 😛), I definitely see the benefit and understand that there's not a lot we can do about the unittest usage. Thank you for this, @hidmic. We can try to clarify test frameworks in a contribution guide for new devs in a follow-up.
* Make use of ros_testing to test policy generation. Signed-off-by: Brian Ezequiel Marchi <[email protected]> Co-authored-by: Michel Hidalgo <[email protected]> * Skip test_generate_policy.py tests on Windows. Signed-off-by: Michel Hidalgo <[email protected]> * Revert "Skip test_generate_policy.py tests on Windows." This reverts commit c68f0a0. Signed-off-by: Michel Hidalgo <[email protected]> * Wait for expected ROS graph state. Signed-off-by: Michel Hidalgo <[email protected]> * Boost discovery delay. Signed-off-by: Michel Hidalgo <[email protected]> * Please linter. Signed-off-by: Michel Hidalgo <[email protected]> * Skip tests using RTI Connext w/o a daemon. Signed-off-by: Michel Hidalgo <[email protected]> * Bump generate_policy execution timeout on Windows. Signed-off-by: Michel Hidalgo <[email protected]> * Bump generate_policy execution timeout on Windows again. Signed-off-by: Michel Hidalgo <[email protected]> Co-authored-by: Brian Ezequiel Marchi <[email protected]>
* Make use of ros_testing to test policy generation. Signed-off-by: Brian Ezequiel Marchi <[email protected]> Co-authored-by: Michel Hidalgo <[email protected]> * Skip test_generate_policy.py tests on Windows. Signed-off-by: Michel Hidalgo <[email protected]> * Revert "Skip test_generate_policy.py tests on Windows." This reverts commit c68f0a0. Signed-off-by: Michel Hidalgo <[email protected]> * Wait for expected ROS graph state. Signed-off-by: Michel Hidalgo <[email protected]> * Boost discovery delay. Signed-off-by: Michel Hidalgo <[email protected]> * Please linter. Signed-off-by: Michel Hidalgo <[email protected]> * Skip tests using RTI Connext w/o a daemon. Signed-off-by: Michel Hidalgo <[email protected]> * Bump generate_policy execution timeout on Windows. Signed-off-by: Michel Hidalgo <[email protected]> * Bump generate_policy execution timeout on Windows again. Signed-off-by: Michel Hidalgo <[email protected]> Co-authored-by: Brian Ezequiel Marchi <[email protected]> Co-authored-by: Michel Hidalgo <[email protected]> Co-authored-by: Brian Ezequiel Marchi <[email protected]>
This pull request combines #168 and #212 to increase test coverage and reduces test flakiness for sros2
generate_policy
verb.