Skip to content
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

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Clean up testing infra #388

merged 3 commits into from
Oct 15, 2024

Conversation

mvukov
Copy link
Owner

@mvukov mvukov commented Oct 10, 2024

Turns out --sandbox_default_allow_network=false does all necessary job and we don't need domain_id shenanigans.

@ahans @lalten PTAL.

Copy link
Contributor

@lalten lalten left a 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.

Copy link
Contributor

@ahans ahans left a 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:
Copy link
Contributor

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.

@mvukov
Copy link
Owner Author

mvukov commented Oct 15, 2024

It turns out that ros2_cpp_test and ros2_py_test work correctly in the main branch only because --sandbox_default_allow_network=false is set -- otherwise there would be no network isolation.

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.

@mvukov
Copy link
Owner Author

mvukov commented Oct 15, 2024

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...

@mvukov mvukov merged commit 27c9d75 into main Oct 15, 2024
6 checks passed
@mvukov mvukov deleted the refactor/clean_up_testing_infra branch October 15, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants