-
Notifications
You must be signed in to change notification settings - Fork 324
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
base: master
Are you sure you want to change the base?
Conversation
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.
@@ -92,3 +92,35 @@ pocket_ic_mainnet_test = rule( | |||
executable = True, | |||
test = True, | |||
) | |||
|
|||
def pocket_ic_test(name, test_rule, **kwargs): |
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'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?
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.
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.
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 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?
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 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?
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.
Sorry, I meant a ticket upstream on bazel! With just an internal ticket I doubt we'll follow up & make progress on 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.
This seems like a similar issue: bazelbuild/bazel#14828. Let me study that a bit more later.
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 seems to be a work around by using IPv6 instead of IPv4. @mraszyk maybe that's something you can look into.
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 therequires-network
hack to work around theOperation not permitted
error on darwin.