test(site-publish): prove immutable failure ordering
Test / contract (pull_request) Successful in 7s
Test / contract (pull_request) Successful in 7s
Authored-By: OpenAI (GPT-5) <noreply@openai.com>
This commit is contained in:
@@ -417,6 +417,29 @@ class PublishingTests(unittest.TestCase):
|
||||
immutable_publish.call_args.args[2]["cache_control"],
|
||||
)
|
||||
|
||||
def test_immutable_failure_stops_before_mutable_publication(self):
|
||||
cfg = normalize_site_config(fixture("split-site.yaml"), "baseline.fritzlab.net")
|
||||
artifact = next(item for item in cfg["artifacts"] if item["name"] == "distributions")
|
||||
route = next(item for item in cfg["routes"] if item["artifact"] == "distributions")
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
html = root / artifact["build_dir"]
|
||||
(html / "releases").mkdir(parents=True)
|
||||
(html / "channels").mkdir()
|
||||
(html / "releases" / "1.0.js").write_text("release")
|
||||
(html / "channels" / "stable.json").write_text("channel")
|
||||
|
||||
with patch.dict(os.environ, {
|
||||
"DIST_S3_ACCESS_KEY": "dist-key", "DIST_S3_SECRET_KEY": "dist-secret"
|
||||
}, clear=False), patch.object(
|
||||
deploy, "publish_immutable_rule", side_effect=RuntimeError("immutable failed")
|
||||
), patch.object(deploy, "run") as mutable_run, self.assertRaisesRegex(
|
||||
RuntimeError, "immutable failed"
|
||||
):
|
||||
deploy.s3_sync(artifact, route, root)
|
||||
|
||||
mutable_run.assert_not_called()
|
||||
|
||||
|
||||
def test_absent_artifact_is_detected_before_publish(self):
|
||||
cfg = normalize_site_config(fixture("split-site.yaml"), "baseline.fritzlab.net")
|
||||
|
||||
Reference in New Issue
Block a user