test(ffe): add parametric tests for provider initialization blocking#6379
Draft
leoromanovsky wants to merge 2 commits intomainfrom
Draft
test(ffe): add parametric tests for provider initialization blocking#6379leoromanovsky wants to merge 2 commits intomainfrom
leoromanovsky wants to merge 2 commits intomainfrom
Conversation
Add 5 new tests validating that the OpenFeature provider's initialize() blocks until Remote Config delivers flag configuration, matching the behavior of Java, Go, and Node.js providers. Tests: - test_ffe_init_blocks_until_config_received: config before start - test_ffe_init_returns_real_values_not_defaults: config after start - test_ffe_evaluation_immediately_after_start_without_config: no config - test_ffe_init_blocks_and_resolves_when_config_arrives: mid-block delivery - test_ffe_init_timeout_returns_error: custom timeout + late recovery Also removes the module-level auto-initialization of the OpenFeature provider in the Python parametric weblog. The provider should only be initialized when the test calls /ffe/start, not at server startup. With the blocking initialize() fix (DataDog/dd-trace-py#16650), the module-level init would block server startup for 30s. Requires: DataDog/dd-trace-py#16650 Fixes: FFL-1843
Contributor
|
|
|
✨ Fix all issues with BitsAI or with Cursor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
FFL-1843: Python OpenFeature provider's
initialize()returns in 0.00s without waiting for Remote Config data. The SDK emitsPROVIDER_READYimmediately, and flag evaluations silently return defaults. This affects scripts and short-lived processes where there's no time for RC to deliver config before evaluations happen.The fix is in DataDog/dd-trace-py#16650 which makes
initialize()block with athreading.Eventuntil config arrives (matching Java/Go/Node.js).This PR adds system tests that validate the blocking behavior and a weblog fix needed to support them.
Changes
New test file:
tests/parametric/test_ffe/test_initialization_blocking.py(5 tests)test_ffe_init_blocks_until_config_receivedtest_ffe_init_returns_real_values_not_defaultstest_ffe_evaluation_immediately_after_start_without_configtest_ffe_init_blocks_and_resolves_when_config_arrivestest_ffe_init_timeout_returns_errorWeblog fix: Removed module-level auto-initialization of the OpenFeature provider in the Python parametric weblog (
server.py). The provider should only be initialized when the test calls/ffe/start, not at server startup. With the blockinginitialize()fix, module-level init would block server startup for 30s.Decisions
initialize()but their weblog architectures differ (e.g. Go initializes at container startup, not via/ffe/start).test_ffe_init_blocks_and_resolves_when_config_arrivestest uses a background thread to deliver RC config 2s afterffe_start()is called, proving the blocking wait resolves mid-flight.test_ffe_init_timeout_returns_errortest usesDD_EXPERIMENTAL_FLAGGING_PROVIDER_INITIALIZATION_TIMEOUT_MS=3000to avoid waiting the full 30s default.Testing
All 5 tests pass locally against the patched dd-trace-py from #16650:
Requires: DataDog/dd-trace-py#16650