nixos/tests/ncps: Fix for v0.8

This commit is contained in:
Wael Nasreddine
2026-02-04 16:46:40 -08:00
parent 25fd7488c2
commit e9294bec9e
3 changed files with 4 additions and 72 deletions
-27
View File
@@ -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")
'';
}
-27
View File
@@ -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")
'';
}
+4 -18
View File
@@ -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}")
'';
}