You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2026/10/11 22:05:36 UTC
(hugegraph-doc) branch master updated: fix: validate OINK with cold module caches (#515)
This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph-doc.git
The following commit(s) were added to refs/heads/master by this push:
new ec9ae7b5b fix: validate OINK with cold module caches (#515)
ec9ae7b5b is described below
commit ec9ae7b5b0f34b6e85b5afdcff4a980a62515dcb
Author: imbajin <ji...@apache.org>
AuthorDate: Mon Oct 12 06:05:30 2026 +0800
fix: validate OINK with cold module caches (#515)
Use native quiet output for the module graph.
Exercise warm and empty Hugo caches in CI.
Add real cold-cache and strict-output regressions.
---
.github/workflows/hugo.yml | 5 +++++
scripts/test_update_oink.py | 29 +++++++++++++++++++++++++++++
scripts/update_oink.py | 2 +-
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/hugo.yml b/.github/workflows/hugo.yml
index 05c010d6a..19daadffe 100644
--- a/.github/workflows/hugo.yml
+++ b/.github/workflows/hugo.yml
@@ -276,6 +276,11 @@ jobs:
test "$(go list -m all | wc -l)" -eq 2
test -z "$(go list -m -f '{{ with .Replace }}{{ .Path }}{{ end }}' github.com/pgsty/oink)"
python3 scripts/update_oink.py --check-baseline
+ # PR and push must both exercise module initialization without a
+ # restored Hugo cache, rather than treating cache hits as correctness.
+ cold_cache=$(mktemp -d "$RUNNER_TEMP/oink-cold-cache.XXXXXX")
+ trap 'rm -rf -- "$cold_cache"' EXIT
+ HUGO_CACHEDIR="$cold_cache" python3 scripts/update_oink.py --check-baseline
- name: Select this group's immutable versions
env:
VERSION_IDS: ${{ toJSON(matrix.group.versions) }}
diff --git a/scripts/test_update_oink.py b/scripts/test_update_oink.py
index d9f2b75ea..f7127e4b9 100644
--- a/scripts/test_update_oink.py
+++ b/scripts/test_update_oink.py
@@ -23,6 +23,35 @@ from update_oink import describe_changes, prune_checksums, snapshot
class UpgradeInventoryTest(unittest.TestCase):
+ @unittest.skipUnless(shutil.which(os.environ.get("HUGO_BIN", "hugo")), "Hugo executable is required")
+ def test_real_hugo_graph_with_empty_module_cache(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory) / "site"
+ root.mkdir()
+ before = {}
+ for name in ("go.mod", "go.sum"):
+ before[name] = (update_oink.ROOT / name).read_bytes()
+ (root / name).write_bytes(before[name])
+ (root / "hugo.yaml").write_text("module:\n imports:\n - path: " + MODULE + "\n")
+ with patch.dict(os.environ, {"HUGO_CACHEDIR": str(Path(directory) / "empty-cache")}):
+ version = update_oink.download_locked(root)["Version"]
+ graph = update_oink.verify_hugo_graph(root, version)
+ self.assertEqual(graph.strip(), f"{SITE_MODULE} {MODULE}@{version}")
+ self.assertNotIn("downloading modules", graph)
+ for name, contents in before.items():
+ self.assertEqual((root / name).read_bytes(), contents)
+
+ def test_hugo_graph_suppresses_cold_cache_progress_without_relaxing_validation(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ graph = f"{SITE_MODULE} {MODULE}@v1.2.0\n"
+ with patch.object(update_oink.subprocess, "check_output", return_value=graph) as command:
+ self.assertEqual(update_oink.verify_hugo_graph(root, "v1.2.0"), graph)
+ self.assertIn("--quiet", command.call_args.args[0])
+ with patch.object(update_oink.subprocess, "check_output", return_value=graph + "unexpected diagnostic output\n"):
+ with self.assertRaises(ValueError):
+ update_oink.verify_hugo_graph(root, "v1.2.0")
+
def test_default_hugo_is_resolved_from_subprocess_path(self):
with patch.dict(os.environ, {}, clear=True), \
patch.object(update_oink.shutil, "which") as which:
diff --git a/scripts/update_oink.py b/scripts/update_oink.py
index 6851fac33..0e041b9a0 100644
--- a/scripts/update_oink.py
+++ b/scripts/update_oink.py
@@ -88,7 +88,7 @@ def verify_hugo_graph(root, version):
env = release_environment()
with graph_workspace(root) as workspace:
graph = subprocess.check_output([env.get("HUGO_BIN", "hugo"), "mod", "graph",
- "--config", "hugo.yaml", "--environment", "production"],
+ "--config", "hugo.yaml", "--environment", "production", "--quiet"],
cwd=workspace, env=env, text=True)
graph = graph.replace(str(workspace), str(Path(root).resolve()))
expected = MODULE + "@" + version