Closed anmarchenko closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.95%. Comparing base (
80e7b13
) to head (25bf96c
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Fixes #147
This PR fixes the following issues with our current Knapsack Pro support:
Dropping tests because of missing test session
When running
knapsack_pro:rspec:queue
command,Datadog.configure
block gets called whenrails_helper
is required which in this case happens afterKnapsackPro::Extensions::RSpecExtension.setup!
had been run.To fix this, we check whether
RSpec::Core::Runner
was already instrumented by knapsack: if yes, we instrumentRSpec::Core::Runner
directly. If not, we hook intoKnapsackPro::Extensions::RSpecExtension
to instrument the runner after knapsack injects its methods:Noise from knapsack_pro:rspec_test_example_detector test command
We noticed that in many cases when using knapsack, we got a lot more test runs than there are unique tests; additional test runs all have very short duration and are part of
knapsack_pro:rspec_test_example_detector
.It turned out, that we trace rspec session that is running with
--dry-run
: test example detector from knapsack uses dry run to generate a report with all rspec examples.This issue is fixed by never tracing rspec tests when dry run is enabled:
How to test the change? Unit tests are provided and additionally tested with Github Actions: https://github.com/DataDog/rails-app-with-knapsack_pro/actions/workflows/main.yaml
The test runs arrived correctly:
There are no additional test runs from
rspec_test_example_detector
- the number of tests is equal to the number of test runs (51 vs 51)