-
Notifications
You must be signed in to change notification settings - Fork 40
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
cargo: add a "failpoints" feature #37
Conversation
Breaking: this changes the library behavior, disabling code generation (in macro) by default. It introduces a `failpoints` Cargo feature that consumers should only enable where relevant (e.g. in testing environments). Transitive consumers of this library can enable this feature too, with the special name `fail/failpoints` (this requires a recent cargo binary). Signed-off-by: Luca Bruno <luca.bruno@coreos.com>
@@ -18,8 +18,11 @@ lazy_static = "1.2" | |||
rand = "0.6" | |||
|
|||
[features] | |||
no_fail = [] | |||
failpoints = [] |
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.
Perhaps make failpoints
as the default feature? Dependencies not wanting failpoints could still opt-out with default-features = false
.
failpoints = [] | |
default = ["failpoints"] | |
failpoints = [] |
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 understand the sentiment behind this suggestion, but unfortunately that will nullify this PR. There is no way for cargo to disable default features across transitive dependencies (by design). It does provide a way to enable them though, via the crate/feature
syntax.
This library features should be handled by chaining upward the opt-in switch, and leaving the final decision to the top consumer.
I acknowledge this is a breaking change, but at the same time I do believe failpoints are an instrumentation feature mostly meant for testing/debugging mode (i.e. not normally present in release-mode binary)
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 naming it activation?
/cc @brson @siddontang @overvenus PTAL
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.
@kennytm Do you have any suggestions?
You need to update all the CI configuration files to run tests with failpoints feature. |
An overall update:
A middle-ground solution could be to make this |
I'm OK with overall changes. Well done @lucab! The only thing I concerns about is the feature name, but I don't have strong opinions. |
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 have long wanted this!
@BusyJay @overvenus thanks for reviewing and merging this! Would you mind a |
Yes, I will publish this once #32 is merged. Maybe in 24 hours. |
Breaking: this changes the library behavior, disabling code
generation (in macro) by default.
It introduces a
failpoints
Cargo feature that consumersshould only enable where relevant (e.g. in testing environments).
Transitive consumers of this library can enable this feature too,
with the special name
fail/failpoints
(this requires a recentcargo binary).
Closes: #35