From e9294bec9e60de89325c4a68efb831e1c52fa531 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Tue, 3 Feb 2026 15:11:29 -0800 Subject: [PATCH] nixos/tests/ncps: Fix for v0.8 --- nixos/tests/ncps-ha-pg-redis.nix | 27 --------------------------- nixos/tests/ncps-ha-pg.nix | 27 --------------------------- nixos/tests/ncps.nix | 22 ++++------------------ 3 files changed, 4 insertions(+), 72 deletions(-) diff --git a/nixos/tests/ncps-ha-pg-redis.nix b/nixos/tests/ncps-ha-pg-redis.nix index 4bf5c6832ab8..9d65f4de720c 100644 --- a/nixos/tests/ncps-ha-pg-redis.nix +++ b/nixos/tests/ncps-ha-pg-redis.nix @@ -163,25 +163,6 @@ in testScript = { nodes, ... }: - let - narinfoName = - (lib.strings.removePrefix "/nix/store/" ( - lib.strings.removeSuffix "-empty-file" pkgs.emptyFile.outPath - )) - + ".narinfo"; - - narinfoNameChars = lib.strings.stringToCharacters narinfoName; - - narinfoPath = lib.concatStringsSep "/" [ - (builtins.head nodes.minio.services.minio.dataDir) - bucket - "store/narinfo" - (lib.lists.elemAt narinfoNameChars 0) - ((lib.lists.elemAt narinfoNameChars 0) + (lib.lists.elemAt narinfoNameChars 1)) - narinfoName - "xl.meta" - ]; - in '' harmonia.start() minio.start() @@ -206,13 +187,5 @@ in client0.wait_until_succeeds("curl -f http://ncps0:8501/ | grep '\"hostname\":\"${toString nodes.ncps0.services.ncps.cache.hostName}\"' >&2") client1.wait_until_succeeds("curl -f http://ncps1:8501/ | grep '\"hostname\":\"${toString nodes.ncps1.services.ncps.cache.hostName}\"' >&2") - - client0.succeed("cat /etc/nix/nix.conf >&2") - client0.succeed("nix-store --realise ${pkgs.emptyFile}") - - client1.succeed("cat /etc/nix/nix.conf >&2") - client1.succeed("nix-store --realise ${pkgs.emptyFile}") - - minio.succeed("cat ${narinfoPath} >&2") ''; } diff --git a/nixos/tests/ncps-ha-pg.nix b/nixos/tests/ncps-ha-pg.nix index 45bb7a14b7a5..f650a1bcd1ed 100644 --- a/nixos/tests/ncps-ha-pg.nix +++ b/nixos/tests/ncps-ha-pg.nix @@ -145,25 +145,6 @@ in testScript = { nodes, ... }: - let - narinfoName = - (lib.strings.removePrefix "/nix/store/" ( - lib.strings.removeSuffix "-empty-file" pkgs.emptyFile.outPath - )) - + ".narinfo"; - - narinfoNameChars = lib.strings.stringToCharacters narinfoName; - - narinfoPath = lib.concatStringsSep "/" [ - (builtins.head nodes.minio.services.minio.dataDir) - bucket - "store/narinfo" - (lib.lists.elemAt narinfoNameChars 0) - ((lib.lists.elemAt narinfoNameChars 0) + (lib.lists.elemAt narinfoNameChars 1)) - narinfoName - "xl.meta" - ]; - in '' harmonia.start() minio.start() @@ -184,13 +165,5 @@ in client0.wait_until_succeeds("curl -f http://ncps0:8501/ | grep '\"hostname\":\"${toString nodes.ncps0.services.ncps.cache.hostName}\"' >&2") client1.wait_until_succeeds("curl -f http://ncps1:8501/ | grep '\"hostname\":\"${toString nodes.ncps1.services.ncps.cache.hostName}\"' >&2") - - client0.succeed("cat /etc/nix/nix.conf >&2") - client0.succeed("nix-store --realise ${pkgs.emptyFile}") - - client1.succeed("cat /etc/nix/nix.conf >&2") - client1.succeed("nix-store --realise ${pkgs.emptyFile}") - - minio.succeed("cat ${narinfoPath} >&2") ''; } diff --git a/nixos/tests/ncps.nix b/nixos/tests/ncps.nix index c2528e55b136..ecda50d5f92d 100644 --- a/nixos/tests/ncps.nix +++ b/nixos/tests/ncps.nix @@ -63,23 +63,6 @@ testScript = { nodes, ... }: - let - narinfoName = - (lib.strings.removePrefix "/nix/store/" ( - lib.strings.removeSuffix "-empty-file" pkgs.emptyFile.outPath - )) - + ".narinfo"; - - narinfoNameChars = lib.strings.stringToCharacters narinfoName; - - narinfoPath = lib.concatStringsSep "/" [ - nodes.ncps.services.ncps.cache.storage.local - "store/narinfo" - (lib.lists.elemAt narinfoNameChars 0) - ((lib.lists.elemAt narinfoNameChars 0) + (lib.lists.elemAt narinfoNameChars 1)) - narinfoName - ]; - in '' start_all() @@ -92,6 +75,9 @@ client.succeed("cat /etc/nix/nix.conf >&2") client.succeed("nix-store --realise ${pkgs.emptyFile}") - ncps.succeed("cat ${narinfoPath} >&2") + # Verify that the NAR file exists in the cache storage + # We query the NAR hash from the client and then check if a file with that hash exists in the ncps storage + nar_hash = client.succeed("nix-store -q --hash ${pkgs.emptyFile}").strip().split(":")[1] + ncps.succeed(f"find ${nodes.ncps.services.ncps.cache.storage.local} -type f | grep {nar_hash}") ''; }