@@ -33,7 +33,7 @@ def setUp(self):
33
33
self .addCleanup (patcher .stop )
34
34
35
35
patcher = patch ("datadog_lambda.metric.lambda_metric" )
36
- self .mock_wrapper_lambda_metric = patcher .start ()
36
+ self .mock_lambda_metric = patcher .start ()
37
37
self .addCleanup (patcher .stop )
38
38
39
39
patcher = patch ("datadog_lambda.wrapper.extract_dd_trace_context" )
@@ -57,6 +57,11 @@ def setUp(self):
57
57
self .mock_is_cold_start .return_value = True
58
58
self .addCleanup (patcher .stop )
59
59
60
+ patcher = patch ("datadog_lambda.tags.python_version_tuple" )
61
+ self .mock_python_version_tuple = patcher .start ()
62
+ self .mock_python_version_tuple .return_value = ("2" , "7" , "10" )
63
+ self .addCleanup (patcher .stop )
64
+
60
65
def test_datadog_lambda_wrapper (self ):
61
66
@datadog_lambda_wrapper
62
67
def lambda_handler (event , context ):
@@ -116,7 +121,7 @@ def lambda_handler(event, context):
116
121
117
122
lambda_handler (lambda_event , get_mock_context ())
118
123
119
- self .mock_wrapper_lambda_metric .assert_has_calls (
124
+ self .mock_lambda_metric .assert_has_calls (
120
125
[
121
126
call (
122
127
"aws.lambda.enhanced.invocations" ,
@@ -126,6 +131,8 @@ def lambda_handler(event, context):
126
131
"account_id:123457598159" ,
127
132
"functionname:python-layer-test" ,
128
133
"cold_start:true" ,
134
+ "memorysize:256" ,
135
+ "runtime:python2.7" ,
129
136
],
130
137
)
131
138
]
@@ -145,7 +152,7 @@ def lambda_handler(event, context):
145
152
with self .assertRaises (RuntimeError ):
146
153
lambda_handler (lambda_event , get_mock_context ())
147
154
148
- self .mock_wrapper_lambda_metric .assert_has_calls (
155
+ self .mock_lambda_metric .assert_has_calls (
149
156
[
150
157
call (
151
158
"aws.lambda.enhanced.invocations" ,
@@ -155,6 +162,8 @@ def lambda_handler(event, context):
155
162
"account_id:123457598159" ,
156
163
"functionname:python-layer-test" ,
157
164
"cold_start:true" ,
165
+ "memorysize:256" ,
166
+ "runtime:python2.7" ,
158
167
],
159
168
),
160
169
call (
@@ -165,6 +174,8 @@ def lambda_handler(event, context):
165
174
"account_id:123457598159" ,
166
175
"functionname:python-layer-test" ,
167
176
"cold_start:true" ,
177
+ "memorysize:256" ,
178
+ "runtime:python2.7" ,
168
179
],
169
180
),
170
181
]
@@ -189,7 +200,7 @@ def lambda_handler(event, context):
189
200
lambda_event , get_mock_context (aws_request_id = "second-request-id" )
190
201
)
191
202
192
- self .mock_wrapper_lambda_metric .assert_has_calls (
203
+ self .mock_lambda_metric .assert_has_calls (
193
204
[
194
205
call (
195
206
"aws.lambda.enhanced.invocations" ,
@@ -199,6 +210,8 @@ def lambda_handler(event, context):
199
210
"account_id:123457598159" ,
200
211
"functionname:python-layer-test" ,
201
212
"cold_start:true" ,
213
+ "memorysize:256" ,
214
+ "runtime:python2.7" ,
202
215
],
203
216
),
204
217
call (
@@ -209,6 +222,8 @@ def lambda_handler(event, context):
209
222
"account_id:123457598159" ,
210
223
"functionname:python-layer-test" ,
211
224
"cold_start:false" ,
225
+ "memorysize:256" ,
226
+ "runtime:python2.7" ,
212
227
],
213
228
),
214
229
]
@@ -226,5 +241,5 @@ def lambda_handler(event, context):
226
241
with self .assertRaises (RuntimeError ):
227
242
lambda_handler (lambda_event , get_mock_context ())
228
243
229
- self .mock_wrapper_lambda_metric .assert_not_called ()
244
+ self .mock_lambda_metric .assert_not_called ()
230
245
0 commit comments