Deploy Tabularium on ces-control with verified image reuse and persistent caches
Verify and deploy Tabularium / verify-and-deploy (push) Waiting to run
Verify and deploy Tabularium / verify-and-deploy (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
"""Guard cache invalidation against stale documents and needless metadata rebuilds."""
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
import ci
|
||||
|
||||
|
||||
class FingerprintTests(unittest.TestCase):
|
||||
def test_build_inputs_invalidate_but_metadata_and_caches_do_not(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
subprocess.run(["git", "init", "-q", str(root)], check=True)
|
||||
(root / ".gitignore").write_text(".artifacts/\n**/.next/\n")
|
||||
doc = root / "content/docs/concept.md"
|
||||
doc.parent.mkdir(parents=True)
|
||||
doc.write_text("# Original\n")
|
||||
package = root / "package.json"
|
||||
package.write_text('{"private":true}\n')
|
||||
with patch.object(ci, "ROOT", root):
|
||||
original = ci.fingerprint()
|
||||
(root / "README.md").write_text("metadata only\n")
|
||||
cache = root / "apps/docs/.next/cache/state"
|
||||
cache.parent.mkdir(parents=True)
|
||||
cache.write_text("compiler cache\n")
|
||||
self.assertEqual(original, ci.fingerprint())
|
||||
doc.write_text("# Updated\n")
|
||||
self.assertNotEqual(original, ci.fingerprint())
|
||||
doc.write_text("# Original\n")
|
||||
package.write_text('{"private":true,"version":"2"}\n')
|
||||
self.assertNotEqual(original, ci.fingerprint())
|
||||
package.write_text('{"private":true}\n')
|
||||
doc.rename(doc.with_name("renamed.md"))
|
||||
self.assertNotEqual(original, ci.fingerprint())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user