Skip to content

Commit

Permalink
Khanayan123/add consistent config system tests (#3745)
Browse files Browse the repository at this point in the history
Co-authored-by: Charles de Beauchesne <[email protected]>
Co-authored-by: Mikayla Toffler <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent 63d1b6d commit 56e10a4
Show file tree
Hide file tree
Showing 22 changed files with 539 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ jobs:
- name: Run LIBRARY_CONF_CUSTOM_HEADER_TAGS_INVALID scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"LIBRARY_CONF_CUSTOM_HEADER_TAGS_INVALID"')
run: ./run.sh LIBRARY_CONF_CUSTOM_HEADER_TAGS_INVALID
- name: Run RUNTIME_METRICS_ENABLED scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"RUNTIME_METRICS_ENABLED"')
run: ./run.sh RUNTIME_METRICS_ENABLED
- name: Run TRACING_CONFIG_NONDEFAULT scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"TRACING_CONFIG_NONDEFAULT"')
run: ./run.sh TRACING_CONFIG_NONDEFAULT
Expand Down
8 changes: 8 additions & 0 deletions docs/weblog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,14 @@ Expected query parameters:
This endpoint loads a module/package in applicable languages. It's mainly used for telemetry tests to verify that
the `dependencies-loaded` event is appropriately triggered.

### GET /log/library

This endpoint facilitates logging a message using a logging library. It is primarily designed for testing log injection functionality. Weblog apps must log using JSON format.

The following query parameters are optional:
- `msg`: Specifies the message to be logged. If not provided, the default message "msg" will be logged.
- `level`: Specifies the log level to be used. If not provided, the default log level is "info".

### GET /e2e_single_span

This endpoint will create two spans, a parent span (which is a root-span), and a child span.
Expand Down
6 changes: 6 additions & 0 deletions manifests/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,15 @@ tests/:
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: missing_feature
Test_Config_IntegrationEnabled_False: missing_feature
Test_Config_IntegrationEnabled_True: missing_feature
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature
Test_Config_LogInjection_128Bit_TradeId_Disabled: missing_feature
Test_Config_LogInjection_Default: missing_feature
Test_Config_LogInjection_Enabled: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Configured: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Default: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Empty: missing_feature
Test_Config_RuntimeMetrics_Default: missing_feature
Test_Config_RuntimeMetrics_Enabled: missing_feature
Test_Config_UnifiedServiceTagging_CustomService: missing_feature
Test_Config_UnifiedServiceTagging_Default: missing_feature
test_distributed.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,15 @@ tests/:
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: v3.5.0
Test_Config_IntegrationEnabled_False: v3.5.0
Test_Config_IntegrationEnabled_True: v3.5.0
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (disabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: v3.4.1
Test_Config_ObfuscationQueryStringRegexp_Default: v3.4.1
Test_Config_ObfuscationQueryStringRegexp_Empty: v3.4.1
Test_Config_RuntimeMetrics_Default: incomplete_test_app (test needs to account for dotnet runtime metrics)
Test_Config_RuntimeMetrics_Enabled: incomplete_test_app (test needs to account for dotnet runtime metrics)
Test_Config_UnifiedServiceTagging_CustomService: v3.3.0
Test_Config_UnifiedServiceTagging_Default: v3.3.0
test_data_integrity.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,15 @@ tests/:
uds-echo: missing_feature
Test_Config_IntegrationEnabled_False: irrelevant (not applicable to Go because of how they do auto instrumentation)
Test_Config_IntegrationEnabled_True: irrelevant (not applicable to Go because of how they do auto instrumentation)
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (disabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: v1.67.0
Test_Config_ObfuscationQueryStringRegexp_Default: v1.67.0
Test_Config_ObfuscationQueryStringRegexp_Empty: v1.67.0
Test_Config_RuntimeMetrics_Default: incomplete_test_app (test needs to account for golang runtime metrics)
Test_Config_RuntimeMetrics_Enabled: incomplete_test_app (test needs to account for golang runtime metrics)
Test_Config_UnifiedServiceTagging_CustomService: v1.67.0
Test_Config_UnifiedServiceTagging_Default: v1.67.0
test_data_integrity.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1683,9 +1683,15 @@ tests/:
Test_Config_IntegrationEnabled_True:
'*': irrelevant (kafka endpoints are not implemented)
spring-boot: v1.42.0
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (disabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (weblog endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (weblog endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: v1.39.0
Test_Config_ObfuscationQueryStringRegexp_Default: v1.39.0
Test_Config_ObfuscationQueryStringRegexp_Empty: v1.39.0
Test_Config_RuntimeMetrics_Default: incomplete_test_app (test needs to account for java runtime metrics)
Test_Config_RuntimeMetrics_Enabled: incomplete_test_app (test needs to account for java runtime metrics)
Test_Config_UnifiedServiceTagging_CustomService: v1.39.0
Test_Config_UnifiedServiceTagging_Default: v1.39.0
test_data_integrity.py:
Expand Down
25 changes: 21 additions & 4 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,8 @@ tests/:
test_otel_drop_in.py:
Test_Otel_Drop_In: missing_feature
parametric/:
test_128_bit_traceids.py:
Test_128_Bit_Traceids: *ref_3_0_0
test_config_consistency.py:
Test_Config_Dogstatsd: *ref_5_29_0
Test_Config_RateLimit: *ref_5_25_0
Expand Down Expand Up @@ -835,14 +837,29 @@ tests/:
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: missing_feature
Test_Config_IntegrationEnabled_False:
'*': *ref_5_25_0
express4-typescript: irrelevant
nextjs: irrelevant # nextjs is not related with kafka
express4-typescript: incomplete_test_app
nextjs: incomplete_test_app
Test_Config_IntegrationEnabled_True:
'*': *ref_5_25_0
express4-typescript: irrelevant
nextjs: irrelevant # nextjs is not related with kafka
express4-typescript: incomplete_test_app
nextjs: incomplete_test_app
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (disabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled:
'*': *ref_3_15_0
express4-typescript: incomplete_test_app (endpoint not implemented)
nextjs: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Default:
'*': *ref_3_0_0
express4-typescript: incomplete_test_app (endpoint not implemented)
nextjs: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Enabled:
'*': *ref_3_0_0
express4-typescript: incomplete_test_app (endpoint not implemented)
nextjs: incomplete_test_app (endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: *ref_3_0_0
Test_Config_ObfuscationQueryStringRegexp_Empty: *ref_3_0_0
Test_Config_RuntimeMetrics_Default: *ref_3_0_0
Test_Config_RuntimeMetrics_Enabled: *ref_3_0_0
Test_Config_UnifiedServiceTagging_CustomService: *ref_5_25_0
Test_Config_UnifiedServiceTagging_Default: *ref_5_25_0
test_distributed.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,14 @@ tests/:
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: missing_feature
Test_Config_IntegrationEnabled_False: v1.4.0
Test_Config_IntegrationEnabled_True: v1.4.0
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (not enabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: v1.5.0
Test_Config_ObfuscationQueryStringRegexp_Empty: v1.5.0
Test_Config_RuntimeMetrics_Default: missing_feature
Test_Config_RuntimeMetrics_Enabled: missing_feature
Test_Config_UnifiedServiceTagging_CustomService: v1.4.0
Test_Config_UnifiedServiceTagging_Default: v1.4.0
test_distributed.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,14 @@ tests/:
Test_Config_IntegrationEnabled_True:
'*': irrelevant (kafka endpoint is not implemented)
flask-poc: v2.0.0
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (not enabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: v2.0.0
Test_Config_ObfuscationQueryStringRegexp_Empty: v2.15.0
Test_Config_RuntimeMetrics_Default: incomplete_test_app (test needs to account for python runtime metrics)
Test_Config_RuntimeMetrics_Enabled: incomplete_test_app (test needs to account for python runtime metrics)
Test_Config_UnifiedServiceTagging_CustomService: v2.0.0
Test_Config_UnifiedServiceTagging_Default: v2.0.0
test_data_integrity.py:
Expand Down
6 changes: 6 additions & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,15 @@ tests/:
Test_Config_IntegrationEnabled_True:
'*': irrelevant (endpoint not implemented)
rails70: v2.0.0
Test_Config_LogInjection_128Bit_TradeId_Default: missing_feature (not enabled by default)
Test_Config_LogInjection_128Bit_TradeId_Disabled: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Default: incomplete_test_app (endpoint not implemented)
Test_Config_LogInjection_Enabled: incomplete_test_app (endpoint not implemented)
Test_Config_ObfuscationQueryStringRegexp_Configured: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Default: bug (APMAPI-1013)
Test_Config_ObfuscationQueryStringRegexp_Empty: missing_feature (environment variable is not supported)
Test_Config_RuntimeMetrics_Default: incomplete_test_app (test needs to account for ruby runtime metrics)
Test_Config_RuntimeMetrics_Enabled: incomplete_test_app (test needs to account for ruby runtime metrics)
Test_Config_UnifiedServiceTagging_CustomService: v2.0.0
Test_Config_UnifiedServiceTagging_Default: v2.0.0
test_distributed.py:
Expand Down
25 changes: 22 additions & 3 deletions tests/parametric/test_128_bit_traceids.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_datadog_128_bit_generation_enabled(self, test_agent, test_library):

@missing_feature(context.library == "golang", reason="not implemented")
@missing_feature(context.library < "[email protected]", reason="Implemented in 1.24.0")
@missing_feature(context.library == "nodejs", reason="not implemented")
@missing_feature(context.library < "nodejs@4.19.0", reason="Implemented in 4.19.0 & 3.40.0")
@missing_feature(context.library == "ruby", reason="not implemented")
@pytest.mark.parametrize("library_env", [{"DD_TRACE_PROPAGATION_STYLE": "Datadog"}])
def test_datadog_128_bit_generation_enabled_by_default(self, test_agent, test_library):
Expand Down Expand Up @@ -383,6 +383,7 @@ def test_w3c_128_bit_propagation(self, test_agent, test_library):
assert dd_p_tid == "640cfd8d00000000"
check_128_bit_trace_id(fields[1], trace_id, dd_p_tid)

@missing_feature(context.library < "[email protected]", reason="implemented in 5.7.0 & 4.31.0")
@missing_feature(context.library == "ruby", reason="not implemented")
@pytest.mark.parametrize(
"library_env",
Expand All @@ -409,8 +410,6 @@ def test_w3c_128_bit_propagation_tid_consistent(self, test_agent, test_library):
assert propagation_error is None

@missing_feature(context.library == "ruby", reason="not implemented")
@missing_feature(context.library == "nodejs", reason="not implemented")
@missing_feature(context.library == "java", reason="not implemented")
@pytest.mark.parametrize(
"library_env",
[{"DD_TRACE_PROPAGATION_STYLE": "tracecontext", "DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED": "true"}],
Expand All @@ -422,6 +421,26 @@ def test_w3c_128_bit_propagation_tid_in_chunk_root(self, test_agent, test_librar
with test_library.dd_start_span(name="child", service="service", parent_id=parent.span_id) as child:
pass

traces = test_agent.wait_for_num_traces(1, clear=True, sort_by_start=False)
trace = find_trace(traces, parent.trace_id)
assert len(trace) == 2
first_span = find_first_span_in_trace_payload(trace)
tid_chunk_root = first_span["meta"].get("_dd.p.tid")
assert tid_chunk_root is not None

@missing_feature(context.library == "ruby", reason="not implemented")
@missing_feature(context.library == "java", reason="not implemented")
@pytest.mark.parametrize(
"library_env",
[{"DD_TRACE_PROPAGATION_STYLE": "tracecontext", "DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED": "true"}],
)
def test_w3c_128_bit_propagation_tid_only_in_chunk_root(self, test_agent, test_library):
"""Ensure that only root span contains the tid."""
with test_library:
with test_library.dd_start_span(name="parent", service="service", resource="resource") as parent:
with test_library.dd_start_span(name="child", service="service", parent_id=parent.span_id) as child:
pass

traces = test_agent.wait_for_num_traces(1, clear=True, sort_by_start=False)
trace = find_trace(traces, parent.trace_id)
assert len(trace) == 2
Expand Down
54 changes: 52 additions & 2 deletions tests/parametric/test_config_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Test_Config_TraceAgentURL:
{
"DD_TRACE_AGENT_URL": "unix:///var/run/datadog/apm.socket",
"DD_AGENT_HOST": "localhost",
"DD_AGENT_PORT": "8126",
"DD_TRACE_AGENT_PORT": "8126",
}
],
)
Expand All @@ -153,7 +153,13 @@ def test_dd_trace_agent_unix_url_nonexistent(self, library_env, test_agent, test
# The DD_TRACE_AGENT_URL is validated using the tracer configuration. This approach avoids the need to modify the setup file to create additional containers at the specified URL, which would be unnecessarily complex.
@parametrize(
"library_env",
[{"DD_TRACE_AGENT_URL": "http://random-host:9999/", "DD_AGENT_HOST": "localhost", "DD_AGENT_PORT": "8126"}],
[
{
"DD_TRACE_AGENT_URL": "http://random-host:9999/",
"DD_AGENT_HOST": "localhost",
"DD_TRACE_AGENT_PORT": "8126",
}
],
)
def test_dd_trace_agent_http_url_nonexistent(self, library_env, test_agent, test_library):
with test_library as t:
Expand All @@ -164,6 +170,50 @@ def test_dd_trace_agent_http_url_nonexistent(self, library_env, test_agent, test
assert url.hostname == "random-host"
assert url.port == 9999

@parametrize(
"library_env",
[
{
"DD_TRACE_AGENT_URL": "http://[::1]:5000",
"DD_AGENT_HOST": "localhost",
"DD_TRACE_AGENT_PORT": "8126",
}
],
)
@missing_feature(context.library == "ruby", reason="does not support ipv6")
def test_dd_trace_agent_http_url_ipv6(self, library_env, test_agent, test_library):
with test_library as t:
resp = t.config()

url = urlparse(resp["dd_trace_agent_url"])
assert url.scheme == "http"
assert url.hostname == "::1"
assert url.port == 5000

@parametrize(
"library_env",
[
{
"DD_TRACE_AGENT_URL": "", # Empty string passed to make sure conftest.py does not set trace agent url
"DD_AGENT_HOST": "[::1]",
"DD_TRACE_AGENT_PORT": "5000",
}
],
)
@missing_feature(context.library == "ruby", reason="does not support ipv6 hostname")
@missing_feature(context.library == "dotnet", reason="does not support ipv6 hostname")
@missing_feature(context.library == "php", reason="does not support ipv6 hostname")
@missing_feature(context.library == "golang", reason="does not support ipv6 hostname")
@missing_feature(context.library == "python", reason="does not support ipv6 hostname")
def test_dd_agent_host_ipv6(self, library_env, test_agent, test_library):
with test_library as t:
resp = t.config()

url = urlparse(resp["dd_trace_agent_url"])
assert url.scheme == "http"
assert url.hostname == "::1"
assert url.port == 5000


@scenarios.parametric
@features.tracing_configuration_consistency
Expand Down
Loading

0 comments on commit 56e10a4

Please sign in to comment.