Fix OpenFeature provider hook test isolation - #12178
Conversation
Assert hook behavior semantically across span-enrichment gate states and keep shutdown coverage focused on evaluator cleanup. Environment: Datadog workspace
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
There was a problem hiding this comment.
More details
The revised tests remain deterministic when span enrichment is unset, enabled, or disabled. Exact hook-list validation confirmed the metrics hook is always present, enrichment appears only when explicitly enabled, and evaluator shutdown no longer depends on optional-hook count.
📊 Validated against 10 scenarios · Open Bits AI session
🤖 Datadog Autotest · Commit 56cd3f1 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 79acdfa: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 48dd94d: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
Motivation
Two
ProviderTestcases produce false failures onmasterwhen the experimental span-enrichment gate is enabled in the test environment. The provider correctly registers an additional optional hook in that configuration, but the tests asserted that the complete hook list always contained exactly one entry. These CI Visibility failures create noise for contributors and can hide real OpenFeature regressions.Changes
The provider-hook test now verifies the invariant it actually owns: the flag-evaluation metrics hook is registered whether span enrichment is disabled or enabled. It exercises both gate states explicitly and checks hook membership instead of relying on list size or ordering.
The shutdown test now has a name and assertion aligned with its behavior. It verifies evaluator shutdown and no longer couples lifecycle coverage to the number of optional provider hooks.
Decisions
This is intentionally a test-only change because production behavior is correct: enabling span enrichment should add a hook. The tests reuse the existing explicit gate seam to cover both configurations deterministically, while the dedicated span-enrichment tests remain responsible for the optional hook's own registration behavior. No global environment mutation or timeout adjustment is introduced.
Validation
./gradlew :products:feature-flagging:feature-flagging-api:test --tests datadog.trace.api.openfeature.ProviderTest :products:feature-flagging:feature-flagging-api:spotlessCheck -Prerun.tests.feature-flagging-api -PtestJvm=11 --no-daemon --stacktraceDD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED=true ./gradlew :products:feature-flagging:feature-flagging-api:test --tests datadog.trace.api.openfeature.ProviderTest -Prerun.tests.feature-flagging-api -PtestJvm=11 --no-daemon --stacktrace