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 @@ -160,6 +160,7 @@ tests/:
Test_Config_TraceEnabled: v1.0.1.dev
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: v1.0.1.dev
Test_Stable_Config_Default: missing_feature
test_crashtracking.py: missing_feature
test_dynamic_configuration.py:
TestDynamicConfigV1_EmptyServiceTargets: 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 @@ -421,6 +421,7 @@ tests/:
Test_Config_TraceEnabled: v3.3.0
Test_Config_TraceLogDirectory: v3.3.0
Test_Config_UnifiedServiceTagging: v3.3.0
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: v3.2.0
test_dynamic_configuration.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ tests/:
Test_Config_TraceEnabled: v1.67.0
Test_Config_TraceLogDirectory: v1.70.0
Test_Config_UnifiedServiceTagging: bug (APMAPI-746)
Test_Stable_Config_Default: missing_feature
test_crashtracking.py: missing_feature
test_dynamic_configuration.py:
TestDynamicConfigSamplingRules: v1.64.0
Expand Down
1 change: 1 addition & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ tests/:
Test_Config_TraceEnabled: v1.39.0
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: v1.41.1
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: v1.38.0
test_dynamic_configuration.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ tests/:
Test_Config_TraceEnabled: *ref_4_3_0
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: *ref_5_25_0
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: *ref_5_27_0
test_dynamic_configuration.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ tests/:
Test_Config_TraceEnabled: v1.3.0 # Unknown initial version
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: v1.5.0
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: v1.3.0
test_dynamic_configuration.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ tests/:
Test_Config_TraceEnabled: v2.12.2
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: v2.12.2
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: v2.11.2
test_dynamic_configuration.py:
Expand Down
1 change: 1 addition & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ tests/:
Test_Config_TraceEnabled: v2.0.0
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: v2.5.0
Test_Stable_Config_Default: missing_feature
test_crashtracking.py:
Test_Crashtracking: v2.3.0
test_dynamic_configuration.py:
Expand Down
36 changes: 36 additions & 0 deletions tests/parametric/test_config_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from utils import scenarios, features, context, missing_feature, irrelevant, flaky, bug
from utils.parametric.spec.trace import find_span_in_traces, find_only_span
import os

parametrize = pytest.mark.parametrize

Expand Down Expand Up @@ -386,3 +387,38 @@ def test_dogstatsd_custom_port(self, library_env, test_agent, test_library):
with test_library as t:
resp = t.config()
assert resp["dd_dogstatsd_port"] == "8150"


@scenarios.parametric
@features.stable_configuration_support
class Test_Stable_Config_Default:
"""Verify that stable config works as intended"""

@missing_feature(
context.library in ["ruby", "cpp", "dotnet", "golang", "java", "nodejs", "php", "python"],
reason="does not support stable configurations yet",
)
@pytest.mark.parametrize("library_env", [{"STABLE_CONFIG_SELECTOR": "true", "DD_SERVICE": "not-my-service"}])
def test_config_stable(self, library_env, test_agent, test_library):
path = "/etc/datadog-agent/managed/datadog-apm-libraries/stable/libraries_config.yaml"
stable_config = """
rules:
- selectors:
- origin: environment_variables
matches:
- STABLE_CONFIG_SELECTOR=true
operator: equals
configuration:
DD_SERVICE: my-service
"""

with test_library:
success, message = test_library.container_exec_run(
f"bash -c \"mkdir -p {os.path.dirname(path)} && printf '{stable_config}' | tee {path}\""
)
assert success, message
test_library.container_restart()
config = test_library.config()
assert (
config["dd_service"] == "my-service"
), f"Service name is '{config["dd_service"]}' instead of 'my-service'"
9 changes: 9 additions & 0 deletions utils/_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -2390,5 +2390,14 @@ def otel_propagators_api(test_object):
pytest.mark.features(feature_id=361)(test_object)
return test_object

@staticmethod
def stable_configuration_support(test_object):
"""Enforces that basic stable configuration support exists

https://feature-parity.us1.prod.dog/#/?feature=365
"""
pytest.mark.features(feature_id=365)(test_object)
return test_object


features = _Features()
16 changes: 12 additions & 4 deletions utils/parametric/_library_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(self, url: str, timeout: int, container: Container):
self._base_url = url
self._session = requests.Session()
self.container = container
self.timeout = timeout

# wait for server to start
self._wait(timeout)
Expand All @@ -70,6 +71,10 @@ def _wait(self, timeout):
message = f"Timeout of {timeout} seconds exceeded waiting for HTTP server to start. Please check logs."
_fail(message)

def container_restart(self):
self.container.restart()
self._wait(self.timeout)

def is_alive(self) -> bool:
self.container.reload()
return (
Expand All @@ -96,16 +101,16 @@ def crash(self) -> None:

def container_exec_run(self, command: str) -> tuple[bool, str]:
try:
code, (stdout, _) = self.container.exec_run(command, demux=True)
code, (stdout, stderr) = self.container.exec_run(command, demux=True)
if code is None:
success = False
message = "Exit code from command in the parametric app container is None"
elif stdout is None:
elif stderr is not None or code != 0:
success = False
message = "Stdout from command in the parametric app container is None"
message = f"Error code {code}: {stderr.decode()}"
else:
success = True
message = stdout.decode()
message = stdout.decode() if stdout is not None else ""
except BaseException:
return False, "Encountered an issue running command in the parametric app container"

Expand Down Expand Up @@ -426,6 +431,9 @@ def crash(self) -> None:
def container_exec_run(self, command: str) -> tuple[bool, str]:
return self._client.container_exec_run(command)

def container_restart(self):
self._client.container_restart()

@contextlib.contextmanager
def dd_start_span(
self,
Expand Down