-
Notifications
You must be signed in to change notification settings - Fork 15
test(ffe): add agentless serverless exposure contract #7477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
leoromanovsky
merged 18 commits into
main
from
agent/nodejs-agentless-serverless-exposures
Aug 18, 2026
Merged
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4c36f02
test(ffe): add agentless serverless exposure contract
leoromanovsky f387372
test(ffe): separate serverless contract from SDK enablement
leoromanovsky 972b475
fix(ffe): use integer agentless poll interval
leoromanovsky ab7e4e5
test(ffe): use Datadog exposure route names
leoromanovsky 009373c
test(ffe): cover direct agentless exposure egress
leoromanovsky 6a43bea
test(ffe): account for capture key scrubbing
leoromanovsky 4c2aca8
test: register direct exposure scenario group exception
leoromanovsky be461a4
ci: run direct agentless exposure scenario
leoromanovsky 690a85b
test(ffe): identify Agent exposure tests
leoromanovsky fd59899
test: share exposure egress contract
leoromanovsky e230b5d
test: accept scrubbed sidecar API key
leoromanovsky 0ad24cf
Merge origin/main into agent/nodejs-agentless-serverless-exposures
leoromanovsky 4722018
test(ffe): address exposure review feedback
leoromanovsky d11223f
Merge remote-tracking branch 'origin/main' into agent/nodejs-agentles…
leoromanovsky a5674ac
test(ffe): harden sidecar topology checks
leoromanovsky 64740ce
test(php): mark OTel interoperability regressions as bugs
leoromanovsky 9e37350
test(php): re-enable OTel interoperability tests
leoromanovsky 437603f
Merge remote-tracking branch 'origin/main' into agent/nodejs-agentles…
leoromanovsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| """Test one exposure contract through every supported deployment topology.""" | ||
|
|
||
| from dataclasses import dataclass | ||
|
|
||
| from tests.ffe.utils.exposures import assert_exposure_side_effects_contract, exposure_events_from_data | ||
| from tests.ffe.utils.fixtures import make_ufc_fixture | ||
| from utils import context, features, interfaces, remote_config as rc, scenarios, weblog | ||
| from utils._context._scenarios.endtoend import FeatureFlaggingAgentlessEndToEndScenario | ||
| from utils._context.component_version import Version | ||
| from utils.interfaces._core import ProxyBasedInterfaceValidator | ||
| from utils.mocked_backend.ffe import EXPECTED_API_KEY | ||
|
|
||
| RC_PATH = "datadog/2/FFE_FLAGS" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class ExposureEgress: | ||
| interface: ProxyBasedInterfaceValidator | ||
| excluded_interfaces: tuple[ProxyBasedInterfaceValidator, ...] = () | ||
| expected_api_key: str | None = None | ||
|
|
||
|
|
||
| def exposure_egress() -> ExposureEgress: | ||
| """Return the capture interface and route-only expectations for this topology.""" | ||
| scenario = context.scenario | ||
| if not isinstance(scenario, FeatureFlaggingAgentlessEndToEndScenario): | ||
| assert scenario.name == "FEATURE_FLAGGING_AND_EXPERIMENTATION" | ||
| return ExposureEgress(interfaces.agent) | ||
|
|
||
| if scenario.exposure_egress == "sidecar": | ||
| assert scenario.components["serverless-init"] == Version("1.9.13") | ||
| return ExposureEgress( | ||
| interfaces.datadog_sidecar, | ||
| (interfaces.datadog_direct,), | ||
| "--redacted--", | ||
| ) | ||
|
|
||
| assert scenario.exposure_egress == "direct" | ||
| assert "serverless-init" not in scenario.components | ||
| return ExposureEgress( | ||
| interfaces.datadog_direct, | ||
| (interfaces.datadog_sidecar,), | ||
| EXPECTED_API_KEY, | ||
| ) | ||
|
|
||
|
|
||
| class ExposureEgressContract: | ||
| """One exposure contract inherited by each supported topology adapter.""" | ||
|
|
||
| flag_key = "empty-targeting-key-flag" | ||
| targeting_key = "exposure-egress-user" | ||
|
|
||
| def setup_exposure_egress(self) -> None: | ||
| if not isinstance(context.scenario, FeatureFlaggingAgentlessEndToEndScenario): | ||
| rc.tracer_rc_state.reset().set_config( | ||
| f"{RC_PATH}/exposure-egress/config", | ||
| make_ufc_fixture(self.flag_key), | ||
| ).apply() | ||
|
|
||
| self.responses = [ | ||
| weblog.post( | ||
| "/ffe", | ||
| json={ | ||
| "flag": self.flag_key, | ||
| "variationType": "STRING", | ||
| "defaultValue": "default", | ||
| "targetingKey": self.targeting_key, | ||
| "attributes": {}, | ||
| }, | ||
| ) | ||
| for _ in range(5) | ||
| ] | ||
|
|
||
| def test_exposure_egress(self) -> None: | ||
| egress = exposure_egress() | ||
| matching_requests = assert_exposure_side_effects_contract( | ||
| egress.interface, | ||
| self.responses, | ||
| flag_key=self.flag_key, | ||
| targeting_key=self.targeting_key, | ||
| expected_value="on-value", | ||
| expected_variant="on", | ||
| ) | ||
| assert len(matching_requests) == 1 | ||
|
|
||
| if egress.expected_api_key is None: | ||
| return | ||
|
|
||
| request = matching_requests[0] | ||
| assert request["host"] == "event-platform-intake.datad0g.com" | ||
| assert request["response"]["status_code"] == 202 | ||
|
|
||
| headers = {name.lower(): value for name, value in request["request"]["headers"]} | ||
| assert headers["dd-api-key"] == egress.expected_api_key | ||
|
leoromanovsky marked this conversation as resolved.
Outdated
|
||
|
|
||
| for excluded_interface in egress.excluded_interfaces: | ||
| assert not any( | ||
| exposure_events_from_data(data, {self.flag_key}, self.targeting_key) | ||
| for data in excluded_interface.get_data() | ||
| ) | ||
|
|
||
|
|
||
| @scenarios.feature_flagging_and_experimentation | ||
| @features.feature_flags_exposures | ||
| class Test_FFE_Exposure_Egress_Datadog_Agent(ExposureEgressContract): | ||
| pass | ||
|
|
||
|
|
||
| @scenarios.feature_flagging_and_experimentation_agentless_direct | ||
| @features.feature_flags_exposures | ||
| class Test_FFE_Exposure_Egress_Agentless_Direct(ExposureEgressContract): | ||
| pass | ||
|
|
||
|
|
||
| @scenarios.feature_flagging_and_experimentation_agentless_serverless | ||
| @features.feature_flags_exposures | ||
| class Test_FFE_Exposure_Egress_Agentless_Sidecar(ExposureEgressContract): | ||
| pass | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.