fix: prevent instrumentation to run in test mode #102
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 crateAdepends on another crateB,Bwill be compiled as usual (aka not in test mode) which will not trigger thetestflag.So we need to introduce our own
testingfeature flag forharmonycore and import it with that flag (only during dev/test).More info: https://github.com/rust-lang/rust/issues/59168
e678673d39to8f8b82cda3