Authored-By: OpenAI (GPT-5) <noreply@openai.com>
This commit is contained in:
+39
-4
@@ -473,7 +473,7 @@ class PublishingTests(unittest.TestCase):
|
||||
):
|
||||
deploy.s3_sync(artifact, route, root, previous_contract={
|
||||
"path": "/foo", "access": "public", "artifact": "distributions",
|
||||
"immutable_paths": ["releases"],
|
||||
"immutable_paths": ["foo/releases"],
|
||||
})
|
||||
rendered = [" ".join(command) for command in commands]
|
||||
self.assertTrue(all("foo/releases/*" in command for command in rendered[:2]))
|
||||
@@ -484,7 +484,7 @@ class PublishingTests(unittest.TestCase):
|
||||
previous = {
|
||||
"baseline-dist": {
|
||||
"path": "/dist", "access": "protected", "artifact": "old-name",
|
||||
"immutable_paths": ["releases"],
|
||||
"immutable_paths": ["dist/releases"],
|
||||
}
|
||||
}
|
||||
with self.assertRaisesRegex(RuntimeError, "cannot become public while reusing protected"):
|
||||
@@ -521,7 +521,7 @@ class PublishingTests(unittest.TestCase):
|
||||
html = Path(tmp)
|
||||
filters = deploy.retired_immutable_filters(artifact, route, html, {
|
||||
"path": "/dist", "access": "public", "artifact": "distributions",
|
||||
"immutable_paths": ["releases"],
|
||||
"immutable_paths": ["dist/releases"],
|
||||
})
|
||||
self.assertEqual(["--exclude", "releases/*"], filters)
|
||||
(html / "releases").mkdir()
|
||||
@@ -529,9 +529,44 @@ class PublishingTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(RuntimeError, "collides with retired immutable"):
|
||||
deploy.retired_immutable_filters(artifact, route, html, {
|
||||
"path": "/dist", "access": "public", "artifact": "distributions",
|
||||
"immutable_paths": ["releases"],
|
||||
"immutable_paths": ["dist/releases"],
|
||||
})
|
||||
|
||||
def test_retired_immutable_history_survives_the_following_deployment(self):
|
||||
cfg = normalize_site_config(fixture("split-site.yaml"), "baseline.fritzlab.net")
|
||||
artifact = next(item for item in cfg["artifacts"] if item["name"] == "distributions")
|
||||
artifact["cache_rules"] = [
|
||||
rule for rule in artifact["cache_rules"] if rule["path"] != "releases"
|
||||
]
|
||||
route = next(item for item in cfg["routes"] if item["artifact"] == "distributions")
|
||||
route["path"] = "/"
|
||||
previous = {
|
||||
"baseline-dist": {
|
||||
"path": "/foo", "access": "public", "artifact": "distributions",
|
||||
"immutable_paths": ["foo/releases"],
|
||||
}
|
||||
}
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp)
|
||||
app_dir = root / "app"
|
||||
manifests = app_dir / "manifests"
|
||||
app_dir.mkdir()
|
||||
deploy.render_site_manifests(
|
||||
"baseline.fritzlab.net", ROOT, app_dir, manifests, cfg, previous,
|
||||
)
|
||||
following = deploy.previous_route_contracts(app_dir)
|
||||
self.assertEqual(["foo/releases"], following["baseline-dist"]["immutable_paths"])
|
||||
html = root / "html"
|
||||
html.mkdir()
|
||||
first_filters = deploy.retired_immutable_filters(
|
||||
artifact, route, html, previous["baseline-dist"],
|
||||
)
|
||||
following_filters = deploy.retired_immutable_filters(
|
||||
artifact, route, html, following["baseline-dist"],
|
||||
)
|
||||
self.assertEqual(["--exclude", "foo/releases/*"], first_filters)
|
||||
self.assertEqual(first_filters, following_filters)
|
||||
|
||||
def test_later_route_immutable_failure_stops_all_mutable_publication(self):
|
||||
cfg = normalize_site_config(fixture("split-site.yaml"), "baseline.fritzlab.net")
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
Reference in New Issue
Block a user