Skip to content
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

Khanayan123/enable nodejs consistency test #3144

Merged
merged 29 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fda4090
enable dd_trace_header_tag tests
khanayan123 Sep 26, 2024
c2869e1
enable nodejs config consistency system tests
khanayan123 Sep 30, 2024
950fa5b
clean up pr
khanayan123 Oct 2, 2024
f4181c0
fix & run
khanayan123 Oct 2, 2024
4032acd
make changes
khanayan123 Oct 18, 2024
70a8d9d
fix versions
khanayan123 Oct 22, 2024
3b30ae9
run
khanayan123 Oct 22, 2024
a866c5e
fix failing tests
khanayan123 Oct 22, 2024
fab336e
run lint
khanayan123 Oct 22, 2024
1a74f7a
update manifest file
khanayan123 Oct 22, 2024
0c422f8
try
khanayan123 Oct 23, 2024
f018aa5
update manifest file
khanayan123 Oct 23, 2024
8e78c1c
try again
khanayan123 Oct 24, 2024
1d0f9d1
skip kafka tests
khanayan123 Oct 24, 2024
dbd10ca
change
khanayan123 Oct 25, 2024
7140e27
try
khanayan123 Oct 25, 2024
ec46a6c
update
khanayan123 Oct 29, 2024
b90626c
address feedback
khanayan123 Nov 4, 2024
0fc9456
split up test
khanayan123 Nov 4, 2024
9714944
fix lint
khanayan123 Nov 4, 2024
5f84bee
Fix
khanayan123 Nov 4, 2024
6037ddc
Enable Test_IastStandalone_UpstreamPropagation in nodejs (#3376)
iunanua Nov 6, 2024
c9d29eb
Onboarding: Change amd instance type (#3384)
robertomonteromiguel Nov 6, 2024
09e5442
[python] Skip bugs for 2.16.0 release (#3385)
cbeauchesne Nov 6, 2024
d9f7415
Add -dev on dev version for ruby in parametric scenario (#3387)
cbeauchesne Nov 6, 2024
37cfb21
Fix test-app-java-container (#3388)
raphaelgavache Nov 6, 2024
2f03e70
Onboarding: format datadog-apm-library dep (#3374)
robertomonteromiguel Nov 6, 2024
72677d1
Merge branch 'main' into khanayan123/enable-nodejs-consistency-test
khanayan123 Nov 7, 2024
f823a9a
Merge branch 'main' into khanayan123/enable-nodejs-consistency-test
khanayan123 Nov 7, 2024
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
34 changes: 20 additions & 14 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,11 @@ tests/:
TestAdmisionControllerProfiling: *ref_5_22_0
parametric/:
test_config_consistency.py:
Test_Config_RateLimit: missing_feature
Test_Config_TraceAgentURL: *ref_5_22_0
Test_Config_TraceEnabled: missing_feature
Test_Config_RateLimit: *ref_5_25_0
Test_Config_TraceAgentURL: *ref_5_25_0
Test_Config_TraceEnabled: *ref_4_3_0
Test_Config_TraceLogDirectory: missing_feature
Test_Config_UnifiedServiceTagging: missing_feature
Test_Config_UnifiedServiceTagging: *ref_5_25_0
test_crashtracking.py: missing_feature
test_dynamic_configuration.py:
TestDynamicConfigHeaderTags: missing_feature
Expand Down Expand Up @@ -615,7 +615,7 @@ tests/:
test_span_links.py:
Test_Span_Links: *ref_5_3_0
test_telemetry.py:
Test_Consistent_Configs: missing_feature
Test_Consistent_Configs: *ref_5_25_0
Test_Defaults: *ref_5_6_0
Test_Environment: *ref_5_6_0
Test_TelemetryInstallSignature: *ref_4_23_0
Expand Down Expand Up @@ -655,19 +655,25 @@ tests/:
Test_Client_Stats: missing_feature
test_config_consistency.py:
Test_Config_ClientIPHeader_Configured: *ref_3_13_0
Test_Config_ClientIPHeader_Precedence: missing_feature (all headers listed in the RFC are not supported)
Test_Config_ClientIPHeader_Precedence: *ref_3_19_0
Test_Config_ClientTagQueryString_Configured: missing_feature (adding query string to http.url is not supported)
Test_Config_ClientTagQueryString_Empty: missing_feature (removes query strings by default)
Test_Config_HttpClientErrorStatuses_Default: missing_feature
Test_Config_HttpClientErrorStatuses_FeatureFlagCustom: missing_feature
Test_Config_HttpServerErrorStatuses_Default: missing_feature
Test_Config_HttpServerErrorStatuses_FeatureFlagCustom: missing_feature
Test_Config_IntegrationEnabled_False: missing_feature
Test_Config_IntegrationEnabled_True: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Configured: missing_feature
Test_Config_ObfuscationQueryStringRegexp_Empty: missing_feature
Test_Config_UnifiedServiceTagging_CustomService: missing_feature
Test_Config_UnifiedServiceTagging_Default: missing_feature
Test_Config_IntegrationEnabled_False:
'*': *ref_5_25_0
express4-typescript: irrelevant
nextjs: irrelevant # nextjs is not related with kafka
Test_Config_IntegrationEnabled_True:
'*': *ref_5_25_0
express4-typescript: irrelevant
nextjs: irrelevant # nextjs is not related with kafka
Test_Config_ObfuscationQueryStringRegexp_Configured: *ref_3_0_0
Test_Config_ObfuscationQueryStringRegexp_Empty: *ref_3_0_0
Test_Config_UnifiedServiceTagging_CustomService: *ref_5_25_0
Test_Config_UnifiedServiceTagging_Default: *ref_5_25_0
test_distributed.py:
Test_DistributedHttp: missing_feature
test_identify.py:
Expand All @@ -680,8 +686,8 @@ tests/:
Test_HeaderTags_Colon_Trailing: *ref_4_11_0
Test_HeaderTags_Long: *ref_4_11_0
Test_HeaderTags_Short: *ref_4_11_0
Test_HeaderTags_Whitespace_Header: bug (AIT-9109)
Test_HeaderTags_Whitespace_Tag: bug (AIT-9109)
Test_HeaderTags_Whitespace_Header: *ref_5_25_0
Test_HeaderTags_Whitespace_Tag: *ref_5_25_0
Test_HeaderTags_Whitespace_Val_Long: *ref_4_11_0
Test_HeaderTags_Whitespace_Val_Short: *ref_4_11_0
test_profiling.py:
Expand Down
5 changes: 4 additions & 1 deletion tests/parametric/test_config_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def test_default_config(self, library_env, test_agent, test_library):

span = find_span_in_traces(traces, s1.trace_id, s1.span_id)
assert span["service"] != "version_test"
assert "version" not in span["meta"]
# in Node.js version can automatically be grabbed from the package.json on default, thus this test does not apply
if test_library.lang != "nodejs":
assert "version" not in span["meta"]
assert "env" not in span["meta"]

# Assert that iff a span has service name set by DD_SERVICE, it also gets the version specified in DD_VERSION
Expand All @@ -98,6 +100,7 @@ def test_specific_version(self, library_env, test_agent, test_library):
assert len(traces) == 2

span1 = find_span_in_traces(traces, s1.trace_id, s1.span_id)

assert span1["service"] == "version_test"
assert span1["meta"]["version"] == "5.2.0"

Expand Down
35 changes: 29 additions & 6 deletions tests/parametric/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ class Test_Consistent_Configs:
"DD_VERSION": "5.2.0",
"DD_TRACE_RATE_LIMIT": 10,
"DD_TRACE_HEADER_TAGS": "User-Agent:my-user-agent,Content-Type.",
"DD_TRACE_ENABLED": "false",
"DD_TRACE_ENABLED": "true",
"DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP": "\d{3}-\d{2}-\d{4}",
"DD_TRACE_LOG_DIRECTORY": "/some/temporary/directory",
"DD_TRACE_CLIENT_IP_HEADER": "random-header-name",
"DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-250",
"DD_TRACE_HTTP_SERVER_ERROR_STATUSES": "250-200",
"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false",
# "DD_TRACE_AGENT_URL": "some-host:some-port", # Don't want to configure this, since we need tracer <> agent connection to run these tests!
# "DD_TRACE_AGENT_URL": "http://localhost:8126", # Don't want to configure this, since we need tracer <> agent connection to run these tests!
# "DD_TRACE_<INTEGRATION>_ENABLED": "N/A", # Skipping because it is blocked by the telemetry intake & this information is already collected through other (non-config) telemetry.
}
],
Expand All @@ -150,18 +150,41 @@ def test_library_settings(self, library_env, test_agent, test_library):
configuration = event["payload"]["configuration"]
configuration_by_name = {item["name"]: item for item in configuration}

# Check that the tags name match the expected value
# # Check that the tags name match the expected value
assert configuration_by_name.get("DD_ENV").get("value") == "dev"
assert configuration_by_name.get("DD_SERVICE").get("value") == "service_test"
assert configuration_by_name.get("DD_VERSION").get("value") == "5.2.0"
assert configuration_by_name.get("DD_TRACE_RATE_LIMIT").get("value") == 10
assert configuration_by_name.get("DD_TRACE_RATE_LIMIT").get("value") == "10"
assert (
configuration_by_name.get("DD_TRACE_HEADER_TAGS").get("value") == "User-Agent:my-user-agent,Content-Type."
)
assert configuration_by_name.get("DD_TRACE_ENABLED").get("value") == False
assert configuration_by_name.get("DD_TRACE_ENABLED").get("value") == True
assert configuration_by_name.get("DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP").get("value") == "\d{3}-\d{2}-\d{4}"
assert configuration_by_name.get("DD_TRACE_LOG_DIRECTORY").get("value") == "/some/temporary/directory"
assert configuration_by_name.get("DD_TRACE_CLIENT_IP_HEADER").get("value") == "random-header-name"

@pytest.mark.parametrize(
"library_env",
[
{
"DD_TELEMETRY_HEARTBEAT_INTERVAL": "0.1", # Decrease the heartbeat/poll intervals to speed up the tests
"DD_TRACE_LOG_DIRECTORY": "/some/temporary/directory",
"DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-250",
"DD_TRACE_HTTP_SERVER_ERROR_STATUSES": "250-200",
"DD_TRACE_HTTP_CLIENT_TAG_QUERY_STRING": "false",
}
],
)
@missing_feature(context.library == "nodejs", reason="Not implemented")
@missing_feature(context.library <= "python@2.16.0", reason="Reports configurations with unexpected names")
@bug(context.library > "cpp@0.2.2", reason="APMAPI-833")
def test_library_settings_2(self, library_env, test_agent, test_library):
with test_library.start_span("test"):
pass
event = test_agent.wait_for_telemetry_event("app-started", wait_loops=400)
configuration = event["payload"]["configuration"]
configuration_by_name = {item["name"]: item for item in configuration}

assert configuration_by_name.get("DD_TRACE_LOG_DIRECTORY").get("value") == "/some/temporary/directory"
assert configuration_by_name.get("DD_TRACE_HTTP_CLIENT_ERROR_STATUSES").get("value") == "200-250"
assert configuration_by_name.get("DD_TRACE_HTTP_SERVER_ERROR_STATUSES").get("value") == "250-200"
assert (
Expand Down
3 changes: 2 additions & 1 deletion tests/test_config_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2022 Datadog, Inc.

import json
from utils import weblog, interfaces, scenarios, features, rfc, irrelevant, context, bug
from utils import weblog, interfaces, scenarios, features, rfc, irrelevant, context, bug, missing_feature


@scenarios.default
Expand Down Expand Up @@ -84,6 +84,7 @@ def setup_query_string_obfuscation_empty_client(self):
self.r = weblog.get("/make_distant_call", params={"url": "http://weblog:7777/?key=monkey"})

@bug(context.library == "java", reason="APMAPI-770")
@missing_feature(context.library == "nodejs", reason="Node only obfuscates queries on the server side")
def test_query_string_obfuscation_empty_client(self):
spans = [s for _, _, s in interfaces.library.get_spans(request=self.r, full_trace=True)]
client_span = _get_span_by_tags(spans, tags={"http.url": "http://weblog:7777/?key=monkey"})
Expand Down
2 changes: 2 additions & 0 deletions utils/_context/_scenarios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ def all_endtoend_scenarios(test_object):
"DD_TRACE_HTTP_CLIENT_ERROR_STATUSES": "200-201,202",
"DD_SERVICE": "service_test",
"DD_TRACE_KAFKA_ENABLED": "false", # Using Kafka as is the most common endpoint and integration(missing for PHP).
"DD_TRACE_KAFKAJS_ENABLED": "false", # In Node the integration is kafkajs.
cbeauchesne marked this conversation as resolved.
Show resolved Hide resolved
"DD_TRACE_PDO_ENABLED": "false", # Use PDO for PHP,
},
include_kafka=True,
Expand All @@ -473,6 +474,7 @@ def all_endtoend_scenarios(test_object):
weblog_env={
"DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP": "",
"DD_TRACE_KAFKA_ENABLED": "true",
"DD_TRACE_KAFKAJS_ENABLED": "true",
"DD_TRACE_PDO_ENABLED": "true", # Use PDO for PHP
"DD_TRACE_CLIENT_IP_HEADER": "custom-ip-header",
"DD_TRACE_CLIENT_IP_ENABLED": "true",
Expand Down
1 change: 1 addition & 0 deletions utils/build/docker/nodejs/parametric/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ app.get('/trace/config', (req, res) => {
'dd_env': config?.tags?.env !== undefined ? `${config.tags.env}` : 'null',
'dd_version': config?.tags?.version !== undefined ? `${config.tags.version}` : 'null',
'dd_trace_agent_url': config?.url !== undefined ? `${config.url.href}` : 'null',
'dd_trace_rate_limit': config?.sampler?.rateLimit !== undefined ? `${config?.sampler?.rateLimit}` :'null'
}
});
});
Expand Down
Loading