tests/nixos/remote-builds*: Inline module + format
(cherry picked from commit 5167351efbee5c5a7390510eb720c31c6976f4d9)
Change-Id: I0caba23b589ed428d08895d7b8f0c22532bd259e
This commit is contained in:
parent
097acae35b
commit
f10e673272
|
@ -28,10 +28,6 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
name = lib.mkDefault "remote-builds-ssh-ng";
|
||||
|
||||
# TODO expand module shorthand syntax instead of use imports
|
||||
imports = [{
|
||||
options = {
|
||||
builders.config = lib.mkOption {
|
||||
type = lib.types.deferredModule;
|
||||
|
@ -41,7 +37,9 @@ in
|
|||
default = { };
|
||||
};
|
||||
};
|
||||
}];
|
||||
|
||||
config = {
|
||||
name = lib.mkDefault "remote-builds-ssh-ng";
|
||||
|
||||
nodes =
|
||||
{ builder =
|
||||
|
@ -96,7 +94,7 @@ in
|
|||
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'")
|
||||
|
||||
# Perform a build
|
||||
out = client.succeed("nix-build ${expr nodes.client.config 1} 2> build-output")
|
||||
out = client.succeed("nix-build ${expr nodes.client 1} 2> build-output")
|
||||
|
||||
# Verify that the build was done on the builder
|
||||
builder.succeed(f"test -e {out.strip()}")
|
||||
|
@ -120,4 +118,5 @@ in
|
|||
# Check that we get phase reporting in the log file
|
||||
client.succeed("grep -q '@nix {\"action\":\"setPhase\",\"phase\":\"buildPhase\"}' log-output")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -37,10 +37,6 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
name = lib.mkDefault "remote-builds";
|
||||
|
||||
# TODO expand module shorthand syntax instead of use imports
|
||||
imports = [{
|
||||
options = {
|
||||
builders.config = lib.mkOption {
|
||||
type = lib.types.deferredModule;
|
||||
|
@ -50,7 +46,9 @@ in
|
|||
default = { };
|
||||
};
|
||||
};
|
||||
}];
|
||||
|
||||
config = {
|
||||
name = lib.mkDefault "remote-builds";
|
||||
|
||||
nodes =
|
||||
{ builder1 = builder;
|
||||
|
@ -105,22 +103,23 @@ in
|
|||
|
||||
# Perform a build and check that it was performed on the builder.
|
||||
out = client.succeed(
|
||||
"nix-build ${expr nodes.client.config 1} 2> build-output",
|
||||
"nix-build ${expr nodes.client 1} 2> build-output",
|
||||
"grep -q Hello build-output"
|
||||
)
|
||||
builder1.succeed(f"test -e {out}")
|
||||
|
||||
# And a parallel build.
|
||||
paths = client.succeed(r'nix-store -r $(nix-instantiate ${expr nodes.client.config 2})\!out $(nix-instantiate ${expr nodes.client.config 3})\!out')
|
||||
paths = client.succeed(r'nix-store -r $(nix-instantiate ${expr nodes.client 2})\!out $(nix-instantiate ${expr nodes.client 3})\!out')
|
||||
out1, out2 = paths.split()
|
||||
builder1.succeed(f"test -e {out1} -o -e {out2}")
|
||||
builder2.succeed(f"test -e {out1} -o -e {out2}")
|
||||
|
||||
# And a failing build.
|
||||
client.fail("nix-build ${expr nodes.client.config 5}")
|
||||
client.fail("nix-build ${expr nodes.client 5}")
|
||||
|
||||
# Test whether the build hook automatically skips unavailable builders.
|
||||
builder1.block()
|
||||
client.succeed("nix-build ${expr nodes.client.config 4}")
|
||||
client.succeed("nix-build ${expr nodes.client 4}")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue