test(deploy): assert Dockerfile and Dockerfile.hf stay byte-identical
Browse filesCo-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tests/deploy/test_dockerfile_hf.py
CHANGED
|
@@ -88,3 +88,17 @@ class TestDockerfileHF:
|
|
| 88 |
"manually on the Space, do not bake it into the image. "
|
| 89 |
f"Offending lines: {env_lines}"
|
| 90 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
"manually on the Space, do not bake it into the image. "
|
| 89 |
f"Offending lines: {env_lines}"
|
| 90 |
)
|
| 91 |
+
|
| 92 |
+
def test_dockerfile_byte_identical_to_hf_alias(self):
|
| 93 |
+
"""`Dockerfile` (HF auto-discovers this name) and `Dockerfile.hf`
|
| 94 |
+
(canonical/readable name) must stay byte-identical. Drift between
|
| 95 |
+
the two means HF builds a different image than the one the test
|
| 96 |
+
suite verifies — silent deploy regression. Catch it in CI."""
|
| 97 |
+
canonical = REPO_ROOT / "Dockerfile.hf"
|
| 98 |
+
alias = REPO_ROOT / "Dockerfile"
|
| 99 |
+
assert canonical.exists(), f"missing {canonical}"
|
| 100 |
+
assert alias.exists(), f"missing {alias}"
|
| 101 |
+
assert canonical.read_bytes() == alias.read_bytes(), (
|
| 102 |
+
"Dockerfile and Dockerfile.hf have diverged. Re-sync them: "
|
| 103 |
+
"`cp Dockerfile.hf Dockerfile` (or vice versa)."
|
| 104 |
+
)
|