@@ -12,7 +12,7 @@ class _BaseDatadogDbIntegrationTestClass(BaseDbIntegrationsTestClass):
1212 Check integration spans status: https://docs.google.com/spreadsheets/d/1qm3B0tJ-gG11j_MHoEd9iMXf4_DvWAGCLwmBhWCxbA8/edit#gid=623219645
1313 """
1414
15- def get_spans (self , excluded_operations = (), operations = None ):
15+ def get_spans (self , excluded_operations : tuple [ str , ...] = (), operations : list [ str ] | None = None ):
1616 """Get the spans from tracer and agent generated by all requests"""
1717
1818 # yield the span from the tracer in first, as if it fails, there is a good chance that the one from the agent also fails
@@ -26,18 +26,18 @@ def get_spans(self, excluded_operations=(), operations=None):
2626 yield db_operation , self .get_span_from_agent (request )
2727
2828 # Tests methods
29- def test_sql_traces (self , excluded_operations = ()):
29+ def test_sql_traces (self , excluded_operations : tuple [ str , ...] = ()):
3030 """After make the requests we check that we are producing sql traces"""
3131 for _ , span in self .get_spans (excluded_operations ):
3232 assert span is not None
3333
3434 def test_resource (self ):
3535 """Usually the query"""
3636
37- for db_operation , span in self .get_spans (excluded_operations = [ "procedure" , "select_error" ] ):
37+ for db_operation , span in self .get_spans (excluded_operations = ( "procedure" , "select_error" ) ):
3838 assert db_operation in span ["resource" ].lower ()
3939
40- def test_sql_success (self , excluded_operations = ()):
40+ def test_sql_success (self , excluded_operations : tuple [ str , ...] = ()):
4141 """We check all sql launched for the app work"""
4242
4343 for db_operation , span in self .get_spans (excluded_operations = excluded_operations + ("select_error" ,)):
@@ -49,7 +49,7 @@ def test_sql_success(self, excluded_operations=()):
4949 raise ValueError (f"Error found in { db_operation } operation, please check captured log call" )
5050
5151 @irrelevant (library = "python" , reason = "Python is using the correct span: db.system" )
52- def test_db_type (self , excluded_operations = ()):
52+ def test_db_type (self , excluded_operations : tuple [ str , ...] = ()):
5353 """DEPRECATED!! Now it is db.system. An identifier for the database management system (DBMS) product being used.
5454 Must be one of the available values: https://datadoghq.atlassian.net/wiki/spaces/APM/pages/2357395856/Span+attributes#db.system
5555 """
@@ -65,7 +65,7 @@ def test_db_name(self):
6565 for db_operation , span in self .get_spans ():
6666 assert span ["meta" ]["db.name" ] == db_container .db_instance , f"Test is failing for { db_operation } "
6767
68- def test_span_kind (self , excluded_operations = ()):
68+ def test_span_kind (self , excluded_operations : tuple [ str , ...] = ()):
6969 """Describes the relationship between the Span, its parents, and its children in a Trace."""
7070
7171 for _ , span in self .get_spans (excluded_operations ):
@@ -98,7 +98,7 @@ def test_db_connection_string(self):
9898 for db_operation , span in self .get_spans ():
9999 assert span ["meta" ]["db.connection_string" ].strip (), f"Test is failing for { db_operation } "
100100
101- def test_db_user (self , excluded_operations = ()):
101+ def test_db_user (self , excluded_operations : tuple [ str , ...] = ()):
102102 """Username for accessing the database."""
103103 db_container = context .get_container_by_dd_integration_name (self .db_service )
104104
@@ -107,7 +107,7 @@ def test_db_user(self, excluded_operations=()):
107107
108108 @missing_feature (library = "python" , reason = "not implemented yet" )
109109 @missing_feature (library = "nodejs" , reason = "not implemented yet" )
110- def test_db_instance (self , excluded_operations = ()):
110+ def test_db_instance (self , excluded_operations : tuple [ str , ...] = ()):
111111 """The name of the database being connected to. Database instance name. Formerly db.name"""
112112 db_container = context .get_container_by_dd_integration_name (self .db_service )
113113
@@ -120,12 +120,12 @@ def test_db_instance(self, excluded_operations=()):
120120 def test_db_statement_query (self ):
121121 """Usually the query"""
122122
123- for db_operation , span in self .get_spans (excluded_operations = [ "procedure" , "select_error" ] ):
123+ for db_operation , span in self .get_spans (excluded_operations = ( "procedure" , "select_error" ) ):
124124 assert db_operation in span ["meta" ]["db.statement" ].lower ()
125125
126126 @missing_feature (library = "nodejs" , reason = "not implemented yet" )
127127 @missing_feature (library = "python" , reason = "not implemented yet" )
128- def test_db_operation (self , excluded_operations = ()):
128+ def test_db_operation (self , excluded_operations : tuple [ str , ...] = ()):
129129 """The name of the operation being executed"""
130130
131131 for db_operation , span in self .get_spans (excluded_operations = excluded_operations + ("select_error" ,)):
@@ -144,7 +144,7 @@ def test_db_operation(self, excluded_operations=()):
144144 def test_db_sql_table (self ):
145145 """The name of the primary table that the operation is acting upon, including the database name (if applicable)."""
146146
147- for db_operation , span in self .get_spans (excluded_operations = [ "procedure" ] ):
147+ for db_operation , span in self .get_spans (excluded_operations = ( "procedure" ,) ):
148148 assert span ["meta" ]["db.sql.table" ].strip (), f"Test is failing for { db_operation } "
149149
150150 @missing_feature (library = "python" , reason = "not implemented yet" )
@@ -158,7 +158,7 @@ def test_db_row_count(self):
158158 for _ , span in self .get_spans (operations = ["select" ]):
159159 assert span ["meta" ]["db.row_count" ] > 0 , "Test is failing for select"
160160
161- def test_db_password (self , excluded_operations = ()):
161+ def test_db_password (self , excluded_operations : tuple [ str , ...] = ()):
162162 """The database password should not show in the traces"""
163163 db_container = context .get_container_by_dd_integration_name (self .db_service )
164164
@@ -214,7 +214,7 @@ def test_sql_query(self):
214214 db_operation in span ["meta" ]["sql.query" ].lower ()
215215 ), f"sql.query span not found for operation { db_operation } "
216216
217- def test_obfuscate_query (self , excluded_operations = ()):
217+ def test_obfuscate_query (self , excluded_operations : tuple [ str , ...] = ()):
218218 """All queries come out obfuscated from agent"""
219219 for db_operation , request in self .get_requests (excluded_operations = excluded_operations ):
220220 span = self .get_span_from_agent (request )
@@ -295,7 +295,7 @@ def test_db_system(self):
295295 def test_db_user (self ):
296296 super ().test_db_user ()
297297
298- def test_obfuscate_query (self , excluded_operations = ()):
298+ def test_obfuscate_query (self , excluded_operations : tuple [ str , ...] = ()):
299299 """All queries come out obfuscated from agent"""
300300 for db_operation , request in self .get_requests (excluded_operations = excluded_operations ):
301301 span = self .get_span_from_agent (request )
0 commit comments