From 53af1119fbec639b613d8155a857034e5364acfc Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Costa Date: Tue, 18 Nov 2025 16:35:47 +0000 Subject: [PATCH] tests: fix fetchers-substitute test for new narHash JSON format The test was failing because nix path-info --json now returns narHash as a structured dictionary {"algorithm": "sha256", "format": "base64", "hash": "..."} instead of an SRI string "sha256-...". This change was introduced in commit 5e7ee808d. The functional test path-info.sh was updated at that time, but this NixOS test was missed. The fix converts the dictionary format to SRI format inline: tarball_hash_sri = f"{narHash_obj['algorithm']}-{narHash_obj['hash']}" --- tests/nixos/fetchers-substitute.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/nixos/fetchers-substitute.nix b/tests/nixos/fetchers-substitute.nix index 453982677..c32744632 100644 --- a/tests/nixos/fetchers-substitute.nix +++ b/tests/nixos/fetchers-substitute.nix @@ -120,7 +120,9 @@ path_info_json = substituter.succeed(f"nix path-info --json {tarball_store_path}").strip() path_info_dict = json.loads(path_info_json) # nix path-info returns a dict with store paths as keys - tarball_hash_sri = path_info_dict[tarball_store_path]["narHash"] + narHash_obj = path_info_dict[tarball_store_path]["narHash"] + # Convert from structured format {"algorithm": "sha256", "format": "base64", "hash": "..."} to SRI string + tarball_hash_sri = f"{narHash_obj['algorithm']}-{narHash_obj['hash']}" print(f"Tarball NAR hash (SRI): {tarball_hash_sri}") # Also get the old format hash for fetchTarball (which uses sha256 parameter)