Skip to content

Commit

Permalink
fix bug in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Spacca committed Dec 8, 2023
1 parent 1e305ea commit 566b99f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions share/secretsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def aws_sm_expander(config_yaml: str) -> str:
Secrets Manager expander for config file
It scans the file for the secrets manager arn pattern, checks for correct configuration,
retrieves the values from the secret manager and replaces them in the config file.
Exceptions will be risen for the following scenarios:
Exceptions will be raised for the following scenarios:
- Not respecting the arn pattern
- Input is for both plain text and json keys for the same secret manager name
- The fetched value is empty
Expand Down Expand Up @@ -153,8 +153,6 @@ def parse_secrets_str(secrets: str, secret_arn: str) -> Union[str, dict[str, Any
except JSONDecodeError:
shared_logger.debug("parsed secrets as plaintext")
return secrets
except Exception as e:
raise Exception(f"{e} while parsing {secret_arn}")
else:
shared_logger.debug("parsed secrets as json")
return parsed_secrets
2 changes: 1 addition & 1 deletion tests/handlers/aws/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ def test_lambda_handler_failure(self) -> None:

handler(event, ctx) # type:ignore

with self.subTest("invalid secretsmanager: json TypeError risen"):
with self.subTest("invalid secretsmanager: json TypeError raised"):
os.environ["S3_CONFIG_FILE"] = "s3://s3_config_file_bucket/s3_config_file_object_key"
with self.assertRaisesRegex(
ConfigFileException,
Expand Down
2 changes: 1 addition & 1 deletion tests/handlers/aws/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_get_trigger_type_and_config_source(self) -> None:
with self.subTest("body in first record: eventSource not override"):
event = {
"Records": [
{"body": '{"Records": [{"eventSource":"not-available-trigger"}]', "eventSource": "aws:kinesis"}
{"body": '{"Records": [{"eventSource":"not-available-trigger"}]}', "eventSource": "aws:kinesis"}
]
}

Expand Down

0 comments on commit 566b99f

Please sign in to comment.