2023-01-28 07:44:41 +01:00
|
|
|
{ pkgs }:
|
2021-12-08 08:13:31 +01:00
|
|
|
|
2021-12-04 10:03:26 +01:00
|
|
|
let
|
2021-12-08 08:13:31 +01:00
|
|
|
tools = pkgs.callPackage ../tools.nix {};
|
2022-12-01 18:55:27 +01:00
|
|
|
in tools.runTest {
|
2021-12-04 10:03:26 +01:00
|
|
|
name = "colmena-parallel";
|
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
colmena.test = {
|
|
|
|
bundle = ./.;
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
testScript = ''
|
|
|
|
deployer.succeed("cd /tmp/bundle &&" \
|
|
|
|
"${tools.colmenaExec} apply push --eval-node-limit 4 --on @target")
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
logs = deployer.succeed("cd /tmp/bundle &&" \
|
|
|
|
"run-copy-stderr ${tools.colmenaExec} apply switch --eval-node-limit 4 --parallel 4 --on @target")
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
for node in [alpha, beta, gamma]:
|
|
|
|
node.succeed("grep SUCCESS /etc/deployment")
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
with subtest("Check that activation is correctly parallelized"):
|
|
|
|
timestamps = list(map(lambda l: int(l.strip().split("---")[1]) / 1000000,
|
|
|
|
filter(lambda l: "Activation triggered" in l, logs.split("\n"))))
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
delay = max(timestamps) - min(timestamps)
|
|
|
|
deployer.log(f"Time between activations: {delay}ms")
|
2021-12-04 10:03:26 +01:00
|
|
|
|
2022-12-01 09:57:56 +01:00
|
|
|
assert delay < 2000
|
|
|
|
'';
|
|
|
|
};
|
2021-12-04 10:03:26 +01:00
|
|
|
}
|