Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: missing_feature
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: missing_feature
test_otel_span_methods.py: irrelevant (library does not implement OpenTelemetry)
test_span_links.py: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: v2.33.0
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: v2.44.0
test_span_links.py: missing_feature
test_telemetry.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: v1.59.0
TestDynamicConfigV1_ServiceTargets: v1.59.0
TestDynamicConfigV2: v1.59.0
test_span_links.py: missing_feature
test_telemetry.py:
Expand Down
2 changes: 1 addition & 1 deletion manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,8 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: v1.17.0
TestDynamicConfigV1_ServiceTargets: v1.31.0
TestDynamicConfigV2: missing_feature

test_span_links.py: missing_feature
test_telemetry.py:
Test_Defaults: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: v4.11.0
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: v4.23.0
test_span_links.py: missing_feature
test_telemetry.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: missing_feature
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: missing_feature
test_otel_span_methods.py:
Test_Otel_Span_Methods: v0.94.0
Expand Down
1 change: 1 addition & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ tests/:
TestDynamicConfigHeaderTags: v2.6.0
TestDynamicConfigTracingEnabled: v2.6.0
TestDynamicConfigV1: missing_feature
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: missing_feature
test_sampling_delegation.py:
Test_Decisionless_Extraction: >-
Expand Down
1 change: 1 addition & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ tests/:
TestDynamicConfigHeaderTags: missing_feature
TestDynamicConfigTracingEnabled: missing_feature
TestDynamicConfigV1: v1.13.0
TestDynamicConfigV1_ServiceTargets: missing_feature
TestDynamicConfigV2: missing_feature
test_otel_span_methods.py:
Test_Otel_Span_Methods: v1.17.0
Expand Down
106 changes: 75 additions & 31 deletions tests/parametric/test_dynamic_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ def test_tracing_client_tracing_disable_one_way(self, library_env, test_agent, t
), "no traces are sent after tracing_enabled: false, even after an RC response with a different setting"


def reverse_case(s):
return "".join([char.lower() if char.isupper() else char.upper() for char in s])


@rfc("https://docs.google.com/document/d/1SVD0zbbAAXIsobbvvfAEXipEUO99R9RMsosftfe9jx0")
@scenarios.parametric
@features.dynamic_configuration
Expand Down Expand Up @@ -256,37 +260,6 @@ def test_apply_state(self, library_env, test_agent, test_library):
assert cfg_state["apply_state"] == 2
assert cfg_state["product"] == "APM_TRACING"

@missing_feature(context.library in ["java", "dotnet", "ruby", "nodejs"], reason="Not implemented yet")
@parametrize(
"library_env",
[
{
**DEFAULT_ENVVARS,
# Override service and env
"DD_SERVICE": s,
"DD_ENV": e,
}
for (s, e) in [
(DEFAULT_ENVVARS["DD_SERVICE"] + "-override", DEFAULT_ENVVARS["DD_ENV"]),
(DEFAULT_ENVVARS["DD_SERVICE"], DEFAULT_ENVVARS["DD_ENV"] + "-override"),
(DEFAULT_ENVVARS["DD_SERVICE"] + "-override", DEFAULT_ENVVARS["DD_ENV"] + "-override"),
]
],
)
def test_not_match_service_target(self, library_env, test_agent, test_library):
"""Test that the library reports an erroneous apply_state when the service targeting is not correct.

This can occur if the library requests Remote Configuration with an initial service + env pair and then
one or both of the values changes.

We simulate this condition by setting DD_SERVICE and DD_ENV to values that differ from the service
target in the RC record.
"""
_set_rc(test_agent, _default_config(TEST_SERVICE, TEST_ENV))
cfg_state = test_agent.wait_for_rc_apply_state("APM_TRACING", state=3)
assert cfg_state["apply_state"] == 3
assert cfg_state["apply_error"] != ""

@parametrize("library_env", [{**DEFAULT_ENVVARS}])
def test_trace_sampling_rate_override_default(self, test_agent, test_library):
"""The RC sampling rate should override the default sampling rate.
Expand Down Expand Up @@ -393,6 +366,77 @@ def test_log_injection_enabled(self, library_env, test_agent, test_library):
assert cfg_state["apply_state"] == 2


@rfc("https://docs.google.com/document/d/1SVD0zbbAAXIsobbvvfAEXipEUO99R9RMsosftfe9jx0")
@scenarios.parametric
@features.dynamic_configuration
class TestDynamicConfigV1_ServiceTargets:
"""Tests covering the Service Target matching of the dynamic configuration feature.

- ignore mismatching targets
- matching service target case-insensitively
"""

@parametrize(
"library_env",
[
{
**DEFAULT_ENVVARS,
# Override service and env
"DD_SERVICE": s,
"DD_ENV": e,
}
for (s, e) in [
(DEFAULT_ENVVARS["DD_SERVICE"] + "-override", DEFAULT_ENVVARS["DD_ENV"]),
(DEFAULT_ENVVARS["DD_SERVICE"], DEFAULT_ENVVARS["DD_ENV"] + "-override"),
(DEFAULT_ENVVARS["DD_SERVICE"] + "-override", DEFAULT_ENVVARS["DD_ENV"] + "-override"),
]
],
)
def test_not_match_service_target(self, library_env, test_agent, test_library):
"""Test that the library reports an erroneous apply_state when the service targeting is not correct.

This can occur if the library requests Remote Configuration with an initial service + env pair and then
one or both of the values changes.

We simulate this condition by setting DD_SERVICE and DD_ENV to values that differ from the service
target in the RC record.
"""
_set_rc(test_agent, _default_config(TEST_SERVICE, TEST_ENV))
cfg_state = test_agent.wait_for_rc_apply_state("APM_TRACING", state=3)
assert cfg_state["apply_state"] == 3
assert cfg_state["apply_error"] != ""

@missing_feature(context.library in ["golang"], reason="Go Tracer does case-sensitive checks for service and env")
@parametrize(
"library_env",
[
{
**DEFAULT_ENVVARS,
# Override service and env
"DD_SERVICE": s,
"DD_ENV": e,
}
for (s, e) in [
(reverse_case(DEFAULT_ENVVARS["DD_SERVICE"]), DEFAULT_ENVVARS["DD_ENV"]),
(DEFAULT_ENVVARS["DD_SERVICE"], reverse_case(DEFAULT_ENVVARS["DD_ENV"])),
(reverse_case(DEFAULT_ENVVARS["DD_SERVICE"]), reverse_case(DEFAULT_ENVVARS["DD_ENV"])),
]
],
)
def test_match_service_target_case_insensitively(self, library_env, test_agent, test_library):
"""Test that the library reports a non-erroneous apply_state when the service targeting is correct but differ in case.

This can occur if the library requests Remote Configuration with an initial service + env pair and then
one or both of the values changes its case.

We simulate this condition by setting DD_SERVICE and DD_ENV to values that differ only in case from the service
target in the RC record.
"""
_set_rc(test_agent, _default_config(TEST_SERVICE, TEST_ENV))
cfg_state = test_agent.wait_for_rc_apply_state("APM_TRACING", state=2)
assert cfg_state["apply_state"] == 2


@rfc("https://docs.google.com/document/d/1V4ZBsTsRPv8pAVG5WCmONvl33Hy3gWdsulkYsE4UZgU/edit")
@scenarios.parametric
@features.dynamic_configuration
Expand Down