Skip to content

Commit c638369

Browse files
authored
fix(ci): use JSON logs for plugin conformance (#792)
1 parent fdca067 commit c638369

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎packages/aws-durable-execution-sdk-python-conformance-tests/template_plugin.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Globals:
55
Runtime: python3.13
66
Timeout: 60
77
MemorySize: 128
8+
LoggingConfig:
9+
LogFormat: JSON
810
Resources:
911
DurableFunctionRole:
1012
Type: AWS::IAM::Role

‎packages/aws-durable-execution-sdk-python-conformance-tests/tests/test_inject_execution_role.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,33 @@ def test_inject_raises_when_no_functions(tmp_path: Path) -> None:
110110

111111
with pytest.raises(SystemExit):
112112
inject_execution_role.inject(template, ROLE_ARN)
113+
114+
115+
def test_plugin_logging_survives_execution_role_injection(tmp_path: Path) -> None:
116+
source = Path(__file__).resolve().parents[1] / "template_plugin.yaml"
117+
original = yaml.safe_load(source.read_text())
118+
expected_functions = {
119+
name: resource
120+
for name, resource in original["Resources"].items()
121+
if resource.get("Type") == "AWS::Serverless::Function"
122+
and "DurableConfig" in resource.get("Properties", {})
123+
}
124+
assert expected_functions
125+
template = _write(tmp_path, original)
126+
127+
assert inject_execution_role.inject(template, ROLE_ARN) == len(expected_functions)
128+
actual = yaml.safe_load(Path(template).read_text())
129+
global_logging = actual["Globals"]["Function"].get("LoggingConfig", {})
130+
for name, original_resource in expected_functions.items():
131+
resource = actual["Resources"][name]
132+
properties = resource["Properties"]
133+
effective_logging = {**global_logging, **properties.get("LoggingConfig", {})}
134+
assert effective_logging.get("LogFormat", "Text") == "JSON", (
135+
f"{name}: Lambda durable functions require JSON logs"
136+
)
137+
assert properties["Role"] == ROLE_ARN
138+
assert (
139+
properties["DurableConfig"]
140+
== original_resource["Properties"]["DurableConfig"]
141+
)
142+
assert resource["TestingMetadata"] == original_resource["TestingMetadata"]

0 commit comments

Comments
 (0)