fix: prevent instrumentation to run in test mode #102

Merged
letian merged 2 commits from fix-ci-test into master 2025-08-11 23:42:14 +00:00
Owner

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 crate A depends on another crate B, B will be compiled as usual (aka not in test mode) which will not trigger the test flag.

So we need to introduce our own testing feature flag for harmony core and import it with that flag (only during dev/test).

More info: https://github.com/rust-lang/rust/issues/59168

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 crate `A` depends on another crate `B`, `B` will be compiled as usual (aka not in test mode) which will not trigger the `test` flag. So we need to introduce our own `testing` feature flag for `harmony` core and import it with that flag (only during dev/test). More info: https://github.com/rust-lang/rust/issues/59168
letian force-pushed fix-ci-test from e678673d39 to 8f8b82cda3 2025-08-11 14:11:06 +00:00 Compare
letian added 1 commit 2025-08-11 23:40:22 +00:00
Merge branch 'master' into fix-ci-test
All checks were successful
Run Check Script / check (pull_request) Successful in 1m13s
eebf2a25cb
letian merged commit 1de96027a1 into master 2025-08-11 23:42:14 +00:00
letian deleted branch fix-ci-test 2025-08-11 23:42:17 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: NationTech/harmony#102
No description provided.