checks: rename attributes for better discoverability

- all eval checks prefixed with `eval-`
- all service checks prefixed with `service-`
This commit is contained in:
DavHau
2025-06-30 19:04:21 +07:00
parent 8b1e8201aa
commit 73b298d0b2
7 changed files with 30 additions and 28 deletions

View File

@@ -234,16 +234,16 @@ Failing nix eval tests look like this:
> error: Tests failed > error: Tests failed
``` ```
To locate the definition, find the flake attribute name of the failing test near the top of the CI Job page, like for example `gitea:clan/clan-core#checks.x86_64-linux.lib-values-eval/1242`. To locate the definition, find the flake attribute name of the failing test near the top of the CI Job page, like for example `gitea:clan/clan-core#checks.x86_64-linux.eval-lib-values/1242`.
In this case `lib-values-eval` is the attribute we are looking for. In this case `eval-lib-values` is the attribute we are looking for.
Find the attribute via ripgrep: Find the attribute via ripgrep:
```shellSession ```shellSession
$ rg "lib-values-eval =" $ rg "eval-lib-values ="
lib/values/flake-module.nix lib/values/flake-module.nix
21: lib-values-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' 21: eval-lib-values = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
grmpf@grmpf-nix ~/p/c/clan-core (test-docs)> grmpf@grmpf-nix ~/p/c/clan-core (test-docs)>
``` ```

View File

@@ -62,26 +62,28 @@ in
in in
lib.mkMerge [ lib.mkMerge [
# Add the VM tests as checks # Add the VM tests as checks
(lib.mapAttrs ( (lib.mapAttrs' (
_name: testModule: name: testModule:
nixosLib.runTest ( lib.nameValuePair "service-${name}" (
{ ... }: nixosLib.runTest (
{ { ... }:
imports = [ {
self.modules.nixosTest.clanTest
testModule
];
hostPkgs = pkgs;
defaults = {
imports = [ imports = [
{ self.modules.nixosTest.clanTest
_module.args.clan-core = self; testModule
}
]; ];
};
} hostPkgs = pkgs;
defaults = {
imports = [
{
_module.args.clan-core = self;
}
];
};
}
)
) )
) cfg) ) cfg)

View File

@@ -18,7 +18,7 @@ in
{ {
legacyPackages.evalTests-values = tests; legacyPackages.evalTests-values = tests;
checks = { checks = {
lib-values-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' eval-lib-values = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)" export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \ --extra-experimental-features flakes \

View File

@@ -36,7 +36,7 @@ in
buildClan = self.clanLib.buildClan; buildClan = self.clanLib.buildClan;
}; };
checks = { checks = {
lib-build-clan-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)" export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \

View File

@@ -20,7 +20,7 @@ in
}; };
checks = { checks = {
lib-distributedServices-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' eval-lib-distributedServices = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)" export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \ --extra-experimental-features flakes \

View File

@@ -26,7 +26,7 @@ in
devShells.inventory-schema = pkgs.mkShell { devShells.inventory-schema = pkgs.mkShell {
name = "clan-inventory-schema"; name = "clan-inventory-schema";
inputsFrom = with config.checks; [ inputsFrom = with config.checks; [
lib-inventory-eval eval-lib-inventory
self'.devShells.default self'.devShells.default
]; ];
}; };
@@ -62,7 +62,7 @@ in
}; };
checks = { checks = {
lib-inventory-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' eval-lib-inventory = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)" export HOME="$(realpath .)"
export NIX_ABORT_ON_WARN=1 export NIX_ABORT_ON_WARN=1
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \

View File

@@ -18,7 +18,7 @@ in
clan-core = self; clan-core = self;
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = inputs.nixpkgs.legacyPackages.${system};
}; };
checks.module-clan-vars-eval = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' checks.eval-module-clan-vars = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
export HOME="$(realpath .)" export HOME="$(realpath .)"
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \