-
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
Clean up testing infra #388
Conversation
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.
lgtm. We already set --sandbox_default_allow_network=false on our side.
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 changes are fine, but I would keep the local domain for testing to not mandate this Bazel setting from downstream projects. Also I'm not sure what'd happen if you bazel run a test. With the local domain it'll always work....
@@ -41,28 +39,22 @@ def main() -> None: | |||
if 'ROS_LOG_DIR' not in os.environ: | |||
os.environ['ROS_LOG_DIR'] = bazel_test_output_dir | |||
|
|||
with contextlib.ExitStack() as stack: |
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.
I would keep this as an extra line of defense. I also find it good practice to use tempfile and not rely on Bazel for stuff like this. But if you really like it, we can always patch locally.
It turns out that ros2_cpp_test and ros2_py_test work correctly in the main branch only because I added additional docs to emphasize that folks should use network isolation. I think we are fine. If someone comes up with a valid test case where they need to get out of network isolation, we can act accordingly. |
Another point: there are use-cases where ros2_test is just an overkill -- e.g. you want to unit test one node. e.g. ros2_cpp_test does the job in those cases. Moreover, ros2_test introduces Python dep and runtime overhead -- which annoys me sometimes... |
Turns out
--sandbox_default_allow_network=false
does all necessary job and we don't need domain_id shenanigans.@ahans @lalten PTAL.