Skip to content

Commit 53af111

Browse files
committed
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 5e7ee80. 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']}"
1 parent 68d2292 commit 53af111

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/nixos/fetchers-substitute.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@
120120
path_info_json = substituter.succeed(f"nix path-info --json {tarball_store_path}").strip()
121121
path_info_dict = json.loads(path_info_json)
122122
# nix path-info returns a dict with store paths as keys
123-
tarball_hash_sri = path_info_dict[tarball_store_path]["narHash"]
123+
narHash_obj = path_info_dict[tarball_store_path]["narHash"]
124+
# Convert from structured format {"algorithm": "sha256", "format": "base64", "hash": "..."} to SRI string
125+
tarball_hash_sri = f"{narHash_obj['algorithm']}-{narHash_obj['hash']}"
124126
print(f"Tarball NAR hash (SRI): {tarball_hash_sri}")
125127
126128
# Also get the old format hash for fetchTarball (which uses sha256 parameter)

0 commit comments

Comments
 (0)