1
+ from typing import TypedDict
2
+
1
3
import boto3
2
4
import pytest
3
5
6
+ from .. import conftest
4
7
from ..utils import helpers
5
8
6
9
7
10
@pytest .fixture (scope = "module" )
8
- def config ():
11
+ def config () -> conftest . LambdaConfig :
9
12
return {
10
13
"parameters" : {},
11
14
"environment_variables" : {
@@ -17,15 +20,15 @@ def config():
17
20
18
21
19
22
@pytest .mark .e2e
20
- def test_basic_lambda_logs_visible (execute_lambda , config ):
23
+ def test_basic_lambda_logs_visible (execute_lambda : conftest . LambdaExecution , config : conftest . LambdaConfig ):
21
24
# GIVEN
22
25
lambda_arn = execute_lambda ["arns" ]["basichandlerarn" ]
23
26
timestamp = int (execute_lambda ["execution_time" ].timestamp () * 1000 )
24
27
cw_client = boto3 .client ("logs" )
25
28
26
29
# WHEN
27
30
filtered_logs = helpers .get_logs (
28
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
31
+ lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client , run = "first"
29
32
)
30
33
31
34
# THEN
@@ -37,7 +40,7 @@ def test_basic_lambda_logs_visible(execute_lambda, config):
37
40
38
41
39
42
@pytest .mark .e2e
40
- def test_basic_lambda_no_debug_logs_visible (execute_lambda , config ):
43
+ def test_basic_lambda_no_debug_logs_visible (execute_lambda : conftest . LambdaExecution , config : conftest . LambdaConfig ):
41
44
# GIVEN
42
45
lambda_arn = execute_lambda ["arns" ]["basichandlerarn" ]
43
46
timestamp = int (execute_lambda ["execution_time" ].timestamp () * 1000 )
@@ -55,7 +58,7 @@ def test_basic_lambda_no_debug_logs_visible(execute_lambda, config):
55
58
56
59
57
60
@pytest .mark .e2e
58
- def test_basic_lambda_contextual_data_logged (execute_lambda ):
61
+ def test_basic_lambda_contextual_data_logged (execute_lambda : conftest . LambdaExecution ):
59
62
# GIVEN
60
63
lambda_arn = execute_lambda ["arns" ]["basichandlerarn" ]
61
64
timestamp = int (execute_lambda ["execution_time" ].timestamp () * 1000 )
@@ -79,9 +82,10 @@ def test_basic_lambda_contextual_data_logged(execute_lambda):
79
82
80
83
81
84
@pytest .mark .e2e
82
- def test_basic_lambda_additional_key_persistence_basic_lambda (execute_lambda , config ):
85
+ def test_basic_lambda_additional_key_persistence_basic_lambda (
86
+ execute_lambda : conftest .LambdaExecution , config : conftest .LambdaConfig
87
+ ):
83
88
# GIVEN
84
-
85
89
lambda_arn = execute_lambda ["arns" ]["basichandlerarn" ]
86
90
timestamp = int (execute_lambda ["execution_time" ].timestamp () * 1000 )
87
91
cw_client = boto3 .client ("logs" )
@@ -101,7 +105,7 @@ def test_basic_lambda_additional_key_persistence_basic_lambda(execute_lambda, co
101
105
102
106
103
107
@pytest .mark .e2e
104
- def test_basic_lambda_empty_event_logged (execute_lambda ):
108
+ def test_basic_lambda_empty_event_logged (execute_lambda : conftest . LambdaExecution ):
105
109
106
110
# GIVEN
107
111
lambda_arn = execute_lambda ["arns" ]["basichandlerarn" ]
@@ -118,7 +122,7 @@ def test_basic_lambda_empty_event_logged(execute_lambda):
118
122
119
123
120
124
@pytest .mark .e2e
121
- def test_no_context_lambda_contextual_data_not_logged (execute_lambda ):
125
+ def test_no_context_lambda_contextual_data_not_logged (execute_lambda : conftest . LambdaExecution ):
122
126
123
127
# GIVEN
124
128
lambda_arn = execute_lambda ["arns" ]["nocontexthandlerarn" ]
@@ -145,7 +149,7 @@ def test_no_context_lambda_contextual_data_not_logged(execute_lambda):
145
149
146
150
147
151
@pytest .mark .e2e
148
- def test_no_context_lambda_event_not_logged (execute_lambda ):
152
+ def test_no_context_lambda_event_not_logged (execute_lambda : conftest . LambdaExecution ):
149
153
150
154
# GIVEN
151
155
lambda_arn = execute_lambda ["arns" ]["nocontexthandlerarn" ]
0 commit comments