hercules-ci-agent: tests: Only build NixOS config for Linux

This commit is contained in:
Robert Hensing 2023-05-23 10:17:12 +02:00 committed by Ilan Joselevich
parent 38fd1bad36
commit 3746d88d79
No known key found for this signature in database

View File

@ -35,38 +35,40 @@ in pkg.overrideAttrs (finalAttrs: o: {
}; };
passthru = o.passthru // { passthru = o.passthru // {
tests.help = runCommand "test-hercules-ci-agent-help" { } '' tests = {
(${finalAttrs.finalPackage}/bin/hercules-ci-agent --help 2>&1 || true) | grep -F -- '--config' help = runCommand "test-hercules-ci-agent-help" { } ''
(${lib.getExe finalAttrs.finalPackage} --help 2>&1 || true) | grep -F -- '--config' (${finalAttrs.finalPackage}/bin/hercules-ci-agent --help 2>&1 || true) | grep -F -- '--config'
touch $out (${lib.getExe finalAttrs.finalPackage} --help 2>&1 || true) | grep -F -- '--config'
''; touch $out
'';
} // lib.optionalAttrs (stdenv.isLinux) {
# Does not test the package, but evaluation of the related NixOS module.
nixos-simple-config = (nixos {
boot.loader.grub.enable = false;
fileSystems."/".device = "bogus";
services.hercules-ci-agent.enable = true;
# Dummy value for testing only.
system.stateVersion = lib.trivial.release; # TEST ONLY
}).config.system.build.toplevel;
# Does not test the package, but evaluation of the related NixOS module. nixos-many-options-config = (nixos ({ pkgs, ... }: {
tests.nixos-simple-config = (nixos { boot.loader.grub.enable = false;
boot.loader.grub.enable = false; fileSystems."/".device = "bogus";
fileSystems."/".device = "bogus"; services.hercules-ci-agent = {
services.hercules-ci-agent.enable = true; enable = true;
# Dummy value for testing only. package = pkgs.hercules-ci-agent;
system.stateVersion = lib.trivial.release; # TEST ONLY settings = {
}).config.system.build.toplevel; workDirectory = "/var/tmp/hci";
binaryCachesPath = "/var/keys/binary-caches.json";
tests.nixos-many-options-config = (nixos ({ pkgs, ... }: { labels.foo.bar.baz = "qux";
boot.loader.grub.enable = false; labels.qux = ["q" "u"];
fileSystems."/".device = "bogus"; apiBaseUrl = "https://hci.dev.biz.example.com";
services.hercules-ci-agent = { concurrentTasks = 42;
enable = true; };
package = pkgs.hercules-ci-agent;
settings = {
workDirectory = "/var/tmp/hci";
binaryCachesPath = "/var/keys/binary-caches.json";
labels.foo.bar.baz = "qux";
labels.qux = ["q" "u"];
apiBaseUrl = "https://hci.dev.biz.example.com";
concurrentTasks = 42;
}; };
}; # Dummy value for testing only.
# Dummy value for testing only. system.stateVersion = lib.trivial.release; # TEST ONLY
system.stateVersion = lib.trivial.release; # TEST ONLY })).config.system.build.toplevel;
})).config.system.build.toplevel; };
}; };
}) })