Skip to content

Commit cd6ec2b

Browse files
tobixleaseshubaws
andauthored
feat: Output remote test-event list error to info log so it isn't counted as failure (aws#8270)
* Output tetst-event list error to info log * Fix formatting issue * Remove ResourceNotFound to use info log for list * Remove missed, unused import --------- Co-authored-by: seshubaws <[email protected]>
1 parent 6e0ee2a commit cd6ec2b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

samcli/lib/shared_test_events/lambda_shared_test_event.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,16 @@ def list_events(
408408
api_caller = self._api_caller
409409

410410
if not api_caller.check_registry_exists(registry_name):
411-
raise ResourceNotFound(f"{registry_name} registry not found. There are no saved events.")
411+
LOG.info(f"{registry_name} registry not found. There are no saved events.")
412+
return ""
412413

413414
schema_name = self._get_schema_name(function_resource)
414415
schema = api_caller.get_schema(registry_name, schema_name)
415416
function_name = function_resource.logical_resource_id
416417

417418
if not schema:
418-
raise ResourceNotFound(f"No events found for function {function_name}")
419+
LOG.info(f"No events found for function {function_name}")
420+
return ""
419421

420422
try:
421423
schema_dict = json.loads(schema)

tests/unit/lib/shared_test_events/test_lambda_shared_test_event.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,8 @@ def test_list_no_schema(self):
423423
{"Error": {"Code": "NotFoundException", "Message": "NotFoundException"}}, "operation"
424424
)
425425

426-
with self.assertRaises(ResourceNotFound) as ctx:
427-
lambda_test_event.list_events(self._cfn_resource("MyFunction"))
428-
429-
msg = "No events found for function myFunction"
430-
self.assertEqual(str(ctx.exception), msg)
426+
output = lambda_test_event.list_events(self._cfn_resource("MyFunction"))
427+
self.assertEqual(output, "")
431428

432429

433430
class TestNoPermissionWrapper(TestCase):

0 commit comments

Comments
 (0)