fix: prevent instrumentation to run in test mode #102
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: NationTech/harmony#102
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix-ci-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CI pipeline (
./check.sh
) was failing because of test errors, which was caused by the instrumentation framework complaining that no subscribers/listeners were registered.Instead of setting up all tests to run with a dummy subscriber, move the implementation of the instrumentation behind a feature flag so that it runs only for tests.
There's a catch though: the
#[cfg(test)]
directive works only when directly testing the crate. If a crateA
depends on another crateB
,B
will be compiled as usual (aka not in test mode) which will not trigger thetest
flag.So we need to introduce our own
testing
feature flag forharmony
core and import it with that flag (only during dev/test).More info: https://github.com/rust-lang/rust/issues/59168
e678673d39
to8f8b82cda3