2023-01-28 07:44:41 +01:00
|
|
|
{ pkgs }:
|
2022-01-02 01:41:35 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
tools = pkgs.callPackage ../tools.nix {
|
|
|
|
deployers = [ "deployer" "alpha" "beta" ];
|
|
|
|
targets = [];
|
|
|
|
};
|
2022-12-01 09:57:56 +01:00
|
|
|
in tools.runTest {
|
2022-01-02 01:41:35 +01:00
|
|
|
name = "colmena-build-on-target";
|
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
colmena.test = {
|
|
|
|
bundle = ./.;
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
testScript = ''
|
|
|
|
# The actual build will be initiated on alpha
|
|
|
|
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply --on alpha")
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
with subtest("Check that the new configurations are indeed applied"):
|
|
|
|
alpha.succeed("grep SUCCESS /etc/deployment")
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
alpha_profile = alpha.succeed("readlink /run/current-system")
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
with subtest("Check that the built profile is not on the deployer"):
|
|
|
|
deployer.fail(f"nix-store -qR {alpha_profile}")
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
with subtest("Check that we can override per-node settings and build locally"):
|
|
|
|
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} build --on alpha --no-build-on-target")
|
|
|
|
deployer.succeed(f"nix-store -qR {alpha_profile}")
|
2022-01-02 01:41:35 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
with subtest("Check that we can override per-node settings and build remotely"):
|
|
|
|
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply --on beta --build-on-target")
|
|
|
|
beta.succeed("grep SUCCESS /etc/deployment")
|
|
|
|
profile = beta.succeed("readlink /run/current-system")
|
|
|
|
deployer.fail(f"nix-store -qR {profile}")
|
|
|
|
'';
|
|
|
|
};
|
2022-01-02 01:41:35 +01:00
|
|
|
}
|