-
Notifications
You must be signed in to change notification settings - Fork 249
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
replace info with launch testing #351
Conversation
Signed-off-by: Karsten Knese <[email protected]>
rosbag2_tests/test/rosbag2_tests/test_rosbag2_info_end_to_end.py
Outdated
Show resolved
Hide resolved
rosbag2_tests/test/rosbag2_tests/test_rosbag2_info_end_to_end.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
b73d0cd
to
512c6fb
Compare
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
Signed-off-by: Karsten Knese <[email protected]>
so this doesn't sound good:
@hidmic the Any help is appreciated. I'd like to have this sorted out before digging deeper into porting all tests to launch testing. |
Signed-off-by: Karsten Knese <[email protected]>
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.
About SIGINT not being sent on Windows, that is (unfortunately) expected. There is no equivalent in Windows, and thus launch
(not the testing framework but the process management infrastructure itself) escalates to a SIGTERM equivalent (see here).
@wjwwood do you recall why CTRL_C_EVENT
was never an option in Windows? I recall it wouldn't work right away, but that's as far as my memory goes.
r'\| Count: 3 \| Serialization Format: cdr\n' | ||
r'\s+Topic: /array_topic \| Type: test_msgs/Arrays ' | ||
r'\| Count: 4 \| Serialization Format: cdr')) | ||
launch_testing.asserts.assertInStdout(proc_output, p, rosbag_info_process) |
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.
@Karsten1987 FYI you can also assert on command.output
, and there's launch_testing.tools.output.expect_output
to aid that if you want.
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.
but expect_output
does not accept a regex pattern, does it?
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.
Yeap, it does. All these assertIn*
functions use expect_output
under the hood.
with launch_testing.tools.launch_process( | ||
launch_service, rosbag_info_process, proc_info, proc_output) as command: | ||
assert command.wait_for_shutdown(timeout=3) | ||
assert command.exit_code == launch_testing.asserts.EXIT_OK |
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.
@Karsten1987 nit: I'd move this statement outside the context manager scope
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.
how do I access the exit code if the command
is out of scope?
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.
command
doesn't leave scope after the with
statement is over :)
try: | ||
shutil.rmtree(dir_path) | ||
except OSError as e: | ||
print("Error: %s : %s" % (dir_path, e.strerror)) |
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.
@Karsten1987 you may want to use setUp()
and tearDown()
methods to create and destroy temporary resources.
with launch_testing.tools.launch_process( | ||
launch_service, rosbag_record_process, proc_info, proc_output) as command: | ||
time.sleep(10) | ||
proc_info.assertWaitForShutdown(rosbag_record_process, timeout=5) |
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.
@Karsten1987 FYI you can use command.wait_for_shutdown
too.
Hmm, I looked at it for a while but I don't see how it got into that state. Exit codes are unrelated. Can you reproduce in a Windows box? If you run |
No I don’t remember the details, only that it is asymmetric between windows and Linux. |
Signed-off-by: Karsten Knese <[email protected]>
Are you guys aware of any workarounds for the Which works pretty decently and rosbag behaves accurately, meaning it receives the Would you have an idea if that route is somewhat feasible? |
After talking with @hidmic I've tried a couple of more things ( In order to stabilize the end to end tests, I have a couple of ideas I'd like to run by you (i.e. @emersonknapp, @piraka9011, @zmichaels11).
Any opinions? |
I too played around with this ctrl-c business on windows (See this branch, specifically, this file). However, my approach kills I came to the conclusion that the right way to go about this is to introduce keyboard commands to control the rosbag2 node, specifically things like The lifecycle node approach is also good, it allows a user to programmatically control the rosbag2 node. I think keyboard/cli/lifecycle node approaches are all valid and we should decide what is the most useful approach (probably lifecycle). Your first approach is the fastest to develop IMO and a good short term solution to the issue. |
FYI, Also played around with the windows creation flags, trying out different combinations one by one... |
Instead of invoking the ros2 cli, can the tests instead just invoke the commands that the cli runs? |
I don't see them as mutual exclusive. I could see how the lifecycle generally offers a way to steer the communication and the keyboard inputs are really only a trigger to the state transitions of that lifecycle. That would make sense to me.
I ran into the same thing. The closest I came to a solution was trying to use
I guess we could tackle the e2e tests starting from |
closing as stale. can reopen if anyone wants to take on this work |
fixes #271 by replacing the end to end tests in
rosbag2_tests
with launch_testing.Signed-off-by: Karsten Knese [email protected]