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

chore(IDX): introduce the pocket_ic_test macro #3268

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

basvandijk
Copy link
Collaborator

This introduces the pocket_ic_test macro exported from //bazel:pocket-ic-tests.bzl. It abstracts over depending on the //rs/pocket_ic_server:pocket-ic-server and setting the requires-network hack to work around the Operation not permitted error on darwin.

This introduces the `pocket_ic_test` macro exported from `//bazel:pocket-ic-tests.bzl`.
It abstracts over depending on the `//rs/pocket_ic_server:pocket-ic-server` and
setting the `requires-network` hack to work around the `Operation not permitted` error
on darwin.
@github-actions github-actions bot added the chore label Dec 19, 2024
@basvandijk basvandijk added the CI_ALL_BAZEL_TARGETS Runs all bazel targets and uploads them to S3 label Dec 19, 2024
@basvandijk basvandijk enabled auto-merge December 19, 2024 20:14
bazel/pocket-ic-tests.bzl Outdated Show resolved Hide resolved
@@ -92,3 +92,35 @@ pocket_ic_mainnet_test = rule(
executable = True,
test = True,
)

def pocket_ic_test(name, test_rule, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too fond of small macros that just wrap a target and inject dependencies; I find they tend to add complexity and obfuscate what is really happening, making everything harder to follow and debug, especially when e.g. the test_rule needs to be specified.

Is the goal here mostly to avoid repetition? Do we have a ticket we can link to re. the sandbox issue on Darwin?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context is in this thread. I would like to have a central place where we do work-arounds for that sandbox issue on darwin and not scatter it all over our code base.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see; agree it's a good idea to have a central place for the workaround but I don't think this requires implicitly injecting pocket-ic. How about modifying rust_ic_test to add requires-network if pocket-ic is a dependency?

Also, can you add a ticket so that we can track the issue upstream and remove the workaround once it's fixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about modifying rust_ic_test to add requires-network if pocket-ic is a dependency?

That seems rather hacky and an implicit rule like that could lead to surprises. Also it's not just rust_ic_test that needs to be modified but also rust_test, rust_test_suite and rust_test_suite_with_extra_srcs. Or do they all resolve back to rust_test?

can you add a ticket so that we can track the issue upstream and remove the workaround once it's fixed?

Good idea: https://dfinity.atlassian.net/browse/IDX-3192

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant a ticket upstream on bazel! With just an internal ticket I doubt we'll follow up & make progress on this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a similar issue: bazelbuild/bazel#14828. Let me study that a bit more later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a work around by using IPv6 instead of IPv4. @mraszyk maybe that's something you can look into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants