Skip to content

Commit 34f2ca8

Browse files
authored
Merge pull request #1952 from DataDog/cbeauchesne/add-features
Add features decorators
2 parents 9cfd2f4 + bdf1d66 commit 34f2ca8

21 files changed

+287
-43
lines changed

pyproject.toml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,25 @@ allow_no_feature_nodes = [
3333
"tests/apm_tracing_e2e/test_otel.py",
3434
"tests/apm_tracing_e2e/test_single_span.py",
3535
"tests/apm_tracing_e2e/test_smoke.py",
36-
"tests/debugger/test_debugger.py",
37-
"tests/integrations/test_cassandra.py",
38-
"tests/integrations/test_db_integrations_sql.py",
39-
"tests/integrations/test_dbm.py",
40-
"tests/integrations/test_dsm.py",
41-
"tests/integrations/test_mongo.py",
42-
"tests/integrations/test_open_telemetry.py",
43-
"tests/integrations/test_sql.py",
4436
"tests/onboarding/test_onboarding_install.py",
4537
"tests/otel_tracing_e2e/test_e2e.py",
4638
"tests/parametric/test_128_bit_traceids.py",
47-
"tests/parametric/test_dynamic_configuration.py",
48-
"tests/parametric/test_headers_b3.py",
49-
"tests/parametric/test_headers_b3multi.py",
50-
"tests/parametric/test_headers_datadog.py",
5139
"tests/parametric/test_headers_none.py",
5240
"tests/parametric/test_headers_precedence.py",
5341
"tests/parametric/test_headers_tracecontext.py",
5442
"tests/parametric/test_headers_tracestate_dd.py",
55-
"tests/parametric/test_library_tracestats.py",
5643
"tests/parametric/test_otel_span_methods.py",
5744
"tests/parametric/test_otel_span_with_w3c.py",
5845
"tests/parametric/test_otel_tracer.py",
59-
"tests/parametric/test_partial_flushing.py",
6046
"tests/parametric/test_sampling_span_tags.py",
6147
"tests/parametric/test_span_links.py",
62-
"tests/parametric/test_span_sampling.py",
63-
"tests/parametric/test_trace_sampling.py",
64-
"tests/parametric/test_tracer_flare.py",
6548
"tests/parametric/test_tracer.py",
6649
"tests/perfs/test_performances.py",
6750
"tests/remote_config/test_remote_configuration.py",
6851
"tests/test_data_integrity.py",
6952
"tests/test_distributed.py",
7053
"tests/test_library_logs.py",
7154
"tests/test_miscs.py",
72-
"tests/test_profiling.py",
7355
"tests/test_schemas.py",
7456
"tests/test_semantic_conventions.py",
7557
"tests/test_smoke.py",

tests/debugger/test_debugger.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2021 Datadog, Inc.
44

5-
from utils import scenarios, interfaces, weblog
5+
from utils import scenarios, interfaces, weblog, features
66
from utils.tools import logger
77

88

@@ -95,6 +95,7 @@ def check_trace(expected_id, trace_map):
9595
check_trace(expected_trace, span_map)
9696

9797

98+
@features.debugger
9899
@scenarios.debugger_probes_status
99100
class Test_Debugger_Probe_Statuses:
100101
def test_method_probe_status(self):
@@ -170,6 +171,7 @@ def wait_for_all_probes_installed(self, data):
170171
return False
171172

172173

174+
@features.debugger
173175
@scenarios.debugger_method_probes_snapshot
174176
class Test_Debugger_Method_Probe_Snaphots(_Base_Debugger_Snapshot_Test):
175177
log_probe_response = None
@@ -215,6 +217,7 @@ def test_method_probe_snaphots(self):
215217
validate_spans(expected_spans)
216218

217219

220+
@features.debugger
218221
@scenarios.debugger_line_probes_snapshot
219222
class Test_Debugger_Line_Probe_Snaphots(_Base_Debugger_Snapshot_Test):
220223
log_probe_response = None
@@ -255,6 +258,7 @@ def test_line_probe_snaphots(self):
255258
validate_spans(expected_spans)
256259

257260

261+
@features.debugger
258262
@scenarios.debugger_mix_log_probe
259263
class Test_Debugger_Mix_Log_Probe(_Base_Debugger_Snapshot_Test):
260264
multi_probe_response = None

tests/integrations/test_cassandra.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2021 Datadog, Inc.
44

5-
from utils import weblog, interfaces, context, missing_feature, scenarios
5+
from utils import weblog, interfaces, context, missing_feature, scenarios, features
66

77

88
@missing_feature(condition=context.library != "java", reason="Endpoint is not implemented on weblog")
9+
@features.cassandra_support
910
@scenarios.integrations
1011
class Test_Cassandra:
1112
""" Verify that a cassandra span is created """

tests/integrations/test_db_integrations_sql.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Unless explicitly stated otherwise all files in this repository are licensed under the the Apache License Version 2.0.
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2021 Datadog, Inc.
4-
from utils import context, bug, missing_feature, irrelevant, scenarios, flaky
4+
from utils import context, bug, missing_feature, irrelevant, scenarios, features
55
from utils.tools import logger
66

77
from .sql_utils import BaseDbIntegrationsTestClass
@@ -222,6 +222,7 @@ def test_obfuscate_query(self, excluded_operations=()):
222222
), f"The query is not properly obfuscated for operation {db_operation}"
223223

224224

225+
@features.postgres_support
225226
@scenarios.integrations
226227
class Test_Postgres(_BaseDatadogDbIntegrationTestClass):
227228
""" Postgres integration with Datadog tracer+agent """
@@ -234,6 +235,7 @@ def test_db_type(self):
234235
super().test_db_type()
235236

236237

238+
@features.mysql_support
237239
@scenarios.integrations
238240
class Test_MySql(_BaseDatadogDbIntegrationTestClass):
239241
""" MySql integration with Datadog tracer+agent """
@@ -250,6 +252,7 @@ def test_db_user(self, excluded_operations=()):
250252
super().test_db_user()
251253

252254

255+
@features.mssql_support
253256
@scenarios.integrations
254257
class Test_MsSql(_BaseDatadogDbIntegrationTestClass):
255258
""" MsSql integration with Datadog tracer+agent """

tests/integrations/test_dbm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
import json
77

8-
from utils import weblog, interfaces, context, scenarios
8+
from utils import weblog, interfaces, context, scenarios, features
99
from utils.tools import logger
1010

1111

12+
@features.database_monitoring_correlation
1213
class Test_Dbm:
1314
"""Verify behavior of DBM propagation"""
1415

tests/integrations/test_dsm.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2023 Datadog, Inc.
44

5-
from utils import weblog, interfaces, scenarios, irrelevant, context, bug
5+
from utils import weblog, interfaces, scenarios, irrelevant, context, bug, features
66
from utils.tools import logger
77

88

9+
@features.datastreams_monitoring_support_for_kafka
910
@scenarios.integrations
1011
class Test_DsmKafka:
1112
""" Verify DSM stats points for Kafka """
@@ -37,6 +38,7 @@ def test_dsm_kafka(self):
3738
)
3839

3940

41+
@features.datastreams_monitoring_support_for_http
4042
@scenarios.integrations
4143
class Test_DsmHttp:
4244
def setup_dsm_http(self):
@@ -52,6 +54,7 @@ def test_dsm_http(self):
5254
)
5355

5456

57+
@features.datastreams_monitoring_support_for_rabbitmq
5558
@scenarios.integrations
5659
class Test_DsmRabbitmq:
5760
""" Verify DSM stats points for RabbitMQ """
@@ -101,6 +104,7 @@ def test_dsm_rabbitmq_dotnet_legacy(self):
101104
)
102105

103106

107+
@features.datastreams_monitoring_support_for_rabbitmq_topicexchange
104108
@scenarios.integrations
105109
class Test_DsmRabbitmq_TopicExchange:
106110
""" Verify DSM stats points for RabbitMQ Topic Exchange"""
@@ -136,6 +140,7 @@ def test_dsm_rabbitmq(self):
136140
)
137141

138142

143+
@features.datastreams_monitoring_support_for_rabbitmq_fanout
139144
@scenarios.integrations
140145
class Test_DsmRabbitmq_FanoutExchange:
141146
""" Verify DSM stats points for RabbitMQ Fanout Exchange"""

tests/integrations/test_mongo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2021 Datadog, Inc.
44

5-
from utils import weblog, interfaces, context, missing_feature, scenarios
5+
from utils import weblog, interfaces, context, missing_feature, scenarios, features
66

77

8+
@features.mongo_support
89
@missing_feature(condition=context.library != "java", reason="Endpoint is not implemented on weblog")
910
@scenarios.integrations
1011
class Test_Mongo:

tests/integrations/test_open_telemetry.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from utils import context, bug, flaky, irrelevant, missing_feature, scenarios
1+
from utils import context, bug, features, irrelevant, missing_feature, scenarios
22
from utils.tools import logger
33
from .sql_utils import BaseDbIntegrationsTestClass
44

@@ -132,20 +132,23 @@ def test_db_statement_query(self):
132132
), f"{db_operation} not found in {span['meta']['db.statement']}"
133133

134134

135+
@features.otel_postgres_support
135136
@scenarios.otel_integrations
136137
class Test_Postgres(_BaseOtelDbIntegrationTestClass):
137138
""" OpenTelemetry/Postgres integration """
138139

139140
db_service = "postgresql"
140141

141142

143+
@features.otel_mysql_support
142144
@scenarios.otel_integrations
143145
class Test_MySql(_BaseOtelDbIntegrationTestClass):
144146
""" OpenTelemetry/MySql integration """
145147

146148
db_service = "mysql"
147149

148150

151+
@features.otel_mssql_support
149152
@scenarios.otel_integrations
150153
class Test_MsSql(_BaseOtelDbIntegrationTestClass):
151154
""" OpenTelemetry/MsSql integration """

tests/integrations/test_sql.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# This product includes software developed at Datadog (https://www.datadoghq.com/).
33
# Copyright 2021 Datadog, Inc.
44

5-
from utils import weblog, interfaces, context, missing_feature, scenarios
5+
from utils import weblog, interfaces, context, missing_feature, scenarios, features
66

77

8+
@features.sql_support
89
@missing_feature(condition=context.library != "java", reason="Endpoint is not implemented on weblog")
910
@scenarios.integrations
1011
class Test_Sql:

tests/parametric/test_dynamic_configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from utils.parametric.spec.remoteconfig import Capabilities
1010
from utils.parametric.spec.trace import Span, assert_trace_has_tags
11-
from utils import context, missing_feature, irrelevant, rfc, scenarios
11+
from utils import context, missing_feature, irrelevant, rfc, scenarios, features
1212

1313
import pytest
1414

@@ -99,6 +99,7 @@ def assert_sampling_rate(trace: List[Dict], rate: float):
9999

100100
@rfc("https://docs.google.com/document/d/1SVD0zbbAAXIsobbvvfAEXipEUO99R9RMsosftfe9jx0")
101101
@scenarios.parametric
102+
@features.dynamic_configuration
102103
class TestDynamicConfigV1:
103104
"""Tests covering the v1 release of the dynamic configuration feature.
104105
@@ -341,6 +342,7 @@ def test_tracing_client_http_header_tags(
341342

342343
@rfc("https://docs.google.com/document/d/1V4ZBsTsRPv8pAVG5WCmONvl33Hy3gWdsulkYsE4UZgU/edit")
343344
@scenarios.parametric
345+
@features.dynamic_configuration
344346
class TestDynamicConfigV2:
345347
@parametrize(
346348
"library_env", [{**DEFAULT_ENVVARS}, {**DEFAULT_ENVVARS, "DD_TAGS": "key1:val1,key2:val2"},],

tests/parametric/test_headers_b3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from utils.parametric.spec.trace import span_has_no_parent
77
from utils.parametric.headers import make_single_request_and_get_inject_headers
88
from utils.parametric.test_agent import get_span
9-
from utils import missing_feature, context, scenarios
9+
from utils import missing_feature, context, scenarios, features
1010

1111
parametrize = pytest.mark.parametrize
1212

@@ -41,6 +41,7 @@ def enable_migrated_b3_single_key() -> Any:
4141
return parametrize("library_env", [env])
4242

4343

44+
@features.b3_headers_propagation
4445
@scenarios.parametric
4546
class Test_Headers_B3:
4647
@enable_b3()

tests/parametric/test_headers_b3multi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from utils.parametric.spec.trace import span_has_no_parent
77
from utils.parametric.headers import make_single_request_and_get_inject_headers
88
from utils.parametric.test_agent import get_span
9-
from utils import missing_feature, irrelevant, context, scenarios
9+
from utils import missing_feature, irrelevant, context, scenarios, features
1010

1111
parametrize = pytest.mark.parametrize
1212

@@ -48,6 +48,7 @@ def enable_case_insensitive_b3multi() -> Any:
4848
return parametrize("library_env", [env1, env2])
4949

5050

51+
@features.b3_headers_propagation
5152
@scenarios.parametric
5253
class Test_Headers_B3multi:
5354
@enable_b3multi()

tests/parametric/test_headers_datadog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import pytest
2-
31
from utils.parametric.spec.trace import SAMPLING_PRIORITY_KEY, ORIGIN
42
from utils.parametric.spec.trace import span_has_no_parent
53
from utils.parametric.headers import make_single_request_and_get_inject_headers
64
from utils.parametric.test_agent import get_span
7-
from utils import bug, context, scenarios
5+
from utils import features, scenarios
86

97

8+
@features.datadog_headers_propagation
109
@scenarios.parametric
1110
class Test_Headers_Datadog:
1211
def test_distributed_headers_extract_datadog_D001(self, test_agent, test_library):

tests/parametric/test_library_tracestats.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from utils.parametric.spec.trace import SPAN_MEASURED_KEY
1313
from utils.parametric.spec.trace import V06StatsAggr
14-
from utils import missing_feature, context, scenarios
14+
from utils import missing_feature, context, scenarios, features
1515

1616
parametrize = pytest.mark.parametrize
1717

@@ -40,6 +40,7 @@ def enable_tracestats(sample_rate: Optional[float] = None) -> Any:
4040

4141

4242
@scenarios.parametric
43+
@features.client_side_stats_supported
4344
class Test_Library_Tracestats:
4445
@enable_tracestats()
4546
@missing_feature(context.library == "cpp", reason="cpp has not implemented stats computation yet")

tests/parametric/test_partial_flushing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import pytest
22
from utils.parametric.spec.trace import Span
33
from utils.parametric.spec.trace import find_span_in_traces
4-
from utils import missing_feature, bug, context, scenarios
4+
from utils import missing_feature, features, context, scenarios
55

66

7+
@features.partial_flush
78
@scenarios.parametric
89
class Test_Partial_Flushing:
910
@pytest.mark.parametrize(

tests/parametric/test_span_sampling.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import time
2+
import json
13
import pytest
24
from utils.parametric.spec.trace import SAMPLING_PRIORITY_KEY
35
from utils.parametric.spec.trace import SINGLE_SPAN_SAMPLING_MAX_PER_SEC
@@ -8,11 +10,10 @@
810
from utils.parametric.spec.trace import USER_KEEP
911
from utils.parametric.spec.trace import Span
1012
from utils.parametric.spec.trace import find_span_in_traces
11-
import time
12-
import json
13-
from utils import missing_feature, context, scenarios
13+
from utils import missing_feature, context, scenarios, features
1414

1515

16+
@features.single_span_sampling
1617
@scenarios.parametric
1718
class Test_Span_Sampling:
1819
@missing_feature(context.library == "ruby", reason="Issue: _dd.span_sampling.max_per_second is always set in Ruby")

0 commit comments

Comments
 (0)