test(ffe): cover agentless CDN configuration-source contract#7277
test(ffe): cover agentless CDN configuration-source contract#7277leoromanovsky wants to merge 25 commits into
Conversation
|
|
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 299f691 | Docs | Datadog PR Page | Give us feedback! |
- Add parametric FFE source-mode test class - Cover RC, CDN, default CDN, and negative fixture cases
- Add mock CDN control and metadata-only status endpoints - Add valid, malformed, and unchanged UFC fixtures
- Add source-mode class rows to all target SDK manifests - Gate rows pending agentless CDN source-mode implementations
- Register mock CDN fixture via pytest_plugins - Keep mock handler typing compatible with instance server state
- Add endpoint-form CDN base URL coverage - Add 509 and 304 transition cases for source-mode L3 - Assert CDN source metadata across mock-backed cases
- add deterministic retry/etag response sequences for CDN source-mode tests - expose metadata-only status code evidence and endpoint URL handling
73df0cf to
2874813
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81bbcdd41a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cbeauchesne
left a comment
There was a problem hiding this comment.
I didn't looked closely the test logic, but as I know nothing aboutthe tested feature, a review from someone else will be a better idea :)
For the framework usage, I do have few questions, the most important one is the compatibility with all setup where system-tests runs. Then, just a few request change on the test-the-test stuff, and all good.
@cbeauchesne Thanks for the suggestions; normal and expected that FFE will approve changes to features, I will hold the PR for their review. |
cbeauchesne
left a comment
There was a problem hiding this comment.
AGTM for framwork usage. I let the real review for the test logic :)
sameerank
left a comment
There was a problem hiding this comment.
You may want to make further adjustments when enabling these tests against an SDK, but this looks like a good start and seems aligned with the RFC so far
|
|
||
| server = MockFFEAgentlessBackendServer(worker_id) | ||
| try: | ||
| env = {"DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_BASE_URL": server.library_config_url} |
There was a problem hiding this comment.
Don't forget to update the DD_FLAGGING_CONFIGURATION_SOURCE* references in the PR description. Also references to "cdn" are now "agentless"
There was a problem hiding this comment.
Thank you; yes, performing a careful synchronization before merging:
RFC -> java trace, run against local update system test -> push trace -> push system test 🚀
| """Validate source selection for Agent RC, agentless, and customer endpoint overrides.""" | ||
|
|
||
| @parametrize("library_env", [{"configuration_source": "remote_config", "response": "valid"}], indirect=True) | ||
| def test_remote_config_positive_ignores_agentless_env( |
There was a problem hiding this comment.
The PR description needs some updating:
test_remote_config_positive_ignores_cdn_envshould be changed to this- there's a reference to
tests/parametric/test_ffe/test_mock_ffe_cdn_reachability.pyin this folder which is no longer in the diff
| class Test_Feature_Flag_Configuration_Source_Mock_Fixture: | ||
| """Validate that the mock backend exposes only metadata needed by the tests.""" | ||
|
|
||
| def test_mock_ffe_agentless_backend_status_is_metadata_only( |
There was a problem hiding this comment.
Your manifest file updates gate this entire file, e.g.
system-tests/manifests/java.yml
Line 3737 in 299f691
But this at least looks like a test that is independent of the SDKs and doesn't need to be gated. Maybe this could set elsewhere like tests/test_the_test/
| test_library: APMLibrary, | ||
| mock_ffe_agentless_backend: MockFFEAgentlessBackendServer, | ||
| ) -> None: | ||
| mock_ffe_agentless_backend.reset() |
There was a problem hiding this comment.
Some feedback from Claude that might be helpful here:
mock_ffe_agentless_backend.reset()runs after the test_library container is already up. It's fine today because provider polling starts atffe_start()(called later), but if any SDK begins agentless polling at process init rather than provider-set, an early erroneous request would be wiped byreset()and_assert_no_mock_requestswould pass falsely. Capturing the clean baseline afterffe_start(), or documenting the lifecycle assumption, would harden it.
| self.send_response(status_code) | ||
| self.send_header("Content-Type", "application/json") | ||
| self.end_headers() |
There was a problem hiding this comment.
.send_response and .end_headers are wrapped in a block in _handle_config
system-tests/utils/docker_fixtures/_mock_ffe_agentless_backend.py
Lines 179 to 191 in 51372e9
Would it make sense to do the same here?
| var activation = ( | ||
| Environment.GetEnvironmentVariable("DD_FEATURE_FLAGS_ENABLED") | ||
| ?? Environment.GetEnvironmentVariable("DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED") | ||
| ?? "0").ToLowerInvariant(); |
There was a problem hiding this comment.
This adds DD_FEATURE_FLAGS_ENABLED as an alias for the legacy enable flag, which makes sense for updating system-tests for using the new env variables.
But fyi, this is the e2e weblog controller, and the parametric suite this PR adds runs against utils/build/docker/dotnet/parametric/Endpoints/ApmTestApi.cs so this edit isn't touched by what the new tests run against
Dismissing at reviewer request after platform feedback was addressed.
Motivation
Server SDK agentless flag delivery needs one shared system-test contract before the SDK implementations land. These tests are intentionally red behind
missing_feature; they define the cross-SDK behavior we expect for configuration-source selection, CDN polling, cold failures, warm preservation, and no-Agent reachability.Tracking:
FFL-2731, under epicFFL-2662.Internal RFC:
Supporting OpenFeature Agentless mode in Server SDKsChanges
Configuration-source tests
remote_config, explicitcdn, defaultcdn, customer endpoint override, invalid source, cold failure/recovery, warm preservation, timeout, and poller no-overlap.DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=trueto enable the current provider; the renamed contract under test isDD_FLAGGING_CONFIGURATION_SOURCE*.Mock FFE CDN
/mock/ufc/configwith test-owned response timelines.tests/parametric/test_ffe/flags-v1.json; malformed UFC stays inline.500for 5xx retryable failures. No509.Docker reachability
host.docker.internal:host-gatewayfor the test agent and for parametric SDK containers when their env points athost.docker.internal.Decisions
Mock scope
Keep the fixture FFE/UFC-specific for this PR. A generic HTTP fixture can come later if another suite needs it.
Configuration model
Customer-hosted HTTP endpoints are covered as
cdnwith a different base URL, not a fourth SDK mode.Provider enablement
This suite does not rename provider enablement. It uses the current system-tests/SDK provider flag and focuses the new contract on configuration-source env vars.
SDK Gates
FFL-2693FFL-2731FFL-2695FFL-2731FFL-2697FFL-2731FFL-2699FFL-2731FFL-2701FFL-2731FFL-2703FFL-2731FFL-2705FFL-2731irrelevantFFL-2731irrelevantFFL-2731Coverage
Source Selection
test_remote_config_positive_ignores_cdn_envflags-v1.json; CDN base URL can be present but mock CDN must receive zero requests.test_remote_config_without_rc_does_not_fallback_to_cdnremote_configwithout RC stays default/not-ready and does not fall back to CDN.test_explicit_cdn_positiveDD_FLAGGING_CONFIGURATION_SOURCE=cdnfetches the mock and evaluates the same flag value as RC.test_default_cdn_positivetest_customer_http_endpoint_default_cdn_positivetest_invalid_configuration_source_fails_closedCold Failure And Recovery
test_missing_auth_coldtest_malformed_coldtest_request_timeout_coldDD_FLAGGING_CONFIGURATION_SOURCE_REQUEST_TIMEOUT_SECONDSis treated as cold failure.test_bad_to_good_cold_recoverytest_bad_to_unchanged_cold_preserves_not_readyWarm State Preservation
test_missing_auth_warmtest_good_to_bad_warm_preservationtest_good_to_unchanged_etag_sequenceIf-None-Matchand keeps evaluator state unchanged.test_malformed_warmPoller And Fixture
test_delayed_no_overlaptest_mock_ffe_cdn_status_is_metadata_onlytest_mock_ffe_cdn_reachable_from_test_agent_networkValidation