@@ -18,14 +18,12 @@ def config() -> conftest.LambdaConfig:
18
18
19
19
def test_basic_lambda_logs_visible (execute_lambda : conftest .InfrastructureOutput , config : conftest .LambdaConfig ):
20
20
# GIVEN
21
- lambda_arn = execute_lambda .get_lambda_arn ( name = "basichandlerarn" )
21
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "basichandlerarn" )
22
22
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
23
23
cw_client = boto3 .client ("logs" )
24
24
25
25
# WHEN
26
- filtered_logs = helpers .get_logs (
27
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
28
- )
26
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
29
27
30
28
# THEN
31
29
assert any (
@@ -39,14 +37,12 @@ def test_basic_lambda_no_debug_logs_visible(
39
37
execute_lambda : conftest .InfrastructureOutput , config : conftest .LambdaConfig
40
38
):
41
39
# GIVEN
42
- lambda_arn = execute_lambda .get_lambda_arn ( name = "basichandlerarn" )
40
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "basichandlerarn" )
43
41
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
44
42
cw_client = boto3 .client ("logs" )
45
43
46
44
# WHEN
47
- filtered_logs = helpers .get_logs (
48
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
49
- )
45
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
50
46
51
47
# THEN
52
48
assert not any (
@@ -65,14 +61,12 @@ def test_basic_lambda_contextual_data_logged(execute_lambda: conftest.Infrastruc
65
61
"cold_start" ,
66
62
)
67
63
68
- lambda_arn = execute_lambda .get_lambda_arn ( name = "basichandlerarn" )
64
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "basichandlerarn" )
69
65
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
70
66
cw_client = boto3 .client ("logs" )
71
67
72
68
# WHEN
73
- filtered_logs = helpers .get_logs (
74
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
75
- )
69
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
76
70
77
71
# THEN
78
72
assert all (keys in logs .dict (exclude_unset = True ) for logs in filtered_logs for keys in required_keys )
@@ -82,14 +76,12 @@ def test_basic_lambda_additional_key_persistence_basic_lambda(
82
76
execute_lambda : conftest .InfrastructureOutput , config : conftest .LambdaConfig
83
77
):
84
78
# GIVEN
85
- lambda_arn = execute_lambda .get_lambda_arn ( name = "basichandlerarn" )
79
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "basichandlerarn" )
86
80
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
87
81
cw_client = boto3 .client ("logs" )
88
82
89
83
# WHEN
90
- filtered_logs = helpers .get_logs (
91
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
92
- )
84
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
93
85
94
86
# THEN
95
87
assert any (
@@ -103,14 +95,12 @@ def test_basic_lambda_additional_key_persistence_basic_lambda(
103
95
def test_basic_lambda_empty_event_logged (execute_lambda : conftest .InfrastructureOutput ):
104
96
105
97
# GIVEN
106
- lambda_arn = execute_lambda .get_lambda_arn ( name = "basichandlerarn" )
98
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "basichandlerarn" )
107
99
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
108
100
cw_client = boto3 .client ("logs" )
109
101
110
102
# WHEN
111
- filtered_logs = helpers .get_logs (
112
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
113
- )
103
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
114
104
115
105
# THEN
116
106
assert any (log .message == {} for log in filtered_logs )
@@ -127,14 +117,12 @@ def test_no_context_lambda_contextual_data_not_logged(execute_lambda: conftest.I
127
117
"cold_start" ,
128
118
)
129
119
130
- lambda_arn = execute_lambda .get_lambda_arn ( name = "nocontexthandlerarn" )
120
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "nocontexthandlerarn" )
131
121
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
132
122
cw_client = boto3 .client ("logs" )
133
123
134
124
# WHEN
135
- filtered_logs = helpers .get_logs (
136
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
137
- )
125
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
138
126
139
127
# THEN
140
128
assert not any (keys in logs .dict (exclude_unset = True ) for logs in filtered_logs for keys in required_missing_keys )
@@ -143,14 +131,12 @@ def test_no_context_lambda_contextual_data_not_logged(execute_lambda: conftest.I
143
131
def test_no_context_lambda_event_not_logged (execute_lambda : conftest .InfrastructureOutput ):
144
132
145
133
# GIVEN
146
- lambda_arn = execute_lambda .get_lambda_arn ( name = "nocontexthandlerarn" )
134
+ lambda_name = execute_lambda .get_lambda_function_name ( cf_output_name = "nocontexthandlerarn" )
147
135
timestamp = execute_lambda .get_lambda_execution_time_timestamp ()
148
136
cw_client = boto3 .client ("logs" )
149
137
150
138
# WHEN
151
- filtered_logs = helpers .get_logs (
152
- lambda_function_name = lambda_arn .split (":" )[- 1 ], start_time = timestamp , log_client = cw_client
153
- )
139
+ filtered_logs = helpers .get_logs (lambda_function_name = lambda_name , start_time = timestamp , log_client = cw_client )
154
140
155
141
# THEN
156
142
assert not any (log .message == {} for log in filtered_logs )
0 commit comments