forked from mlabs-haskell/cardano.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.nix
25 lines (23 loc) · 766 Bytes
/
node.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
perSystem.vmTests.tests.cardano-node = {
impure = true;
module = {
nodes.machine = {pkgs, ...}: {
cardano = {
network = "preview";
cli.enable = true;
node.enable = true;
};
environment.systemPackages = with pkgs; [jq bc];
};
testScript = {nodes, ...}: let
magic = toString nodes.machine.config.cardano.networkNumber;
in ''
machine.wait_for_unit("cardano-node")
machine.wait_until_succeeds("""[[ $(echo "$(cardano-cli query tip --testnet-magic ${magic} | jq '.syncProgress' --raw-output) > 0.001" | bc) == "1" ]]""")
print(machine.succeed("systemd-analyze security cardano-node"))
print('\nVM Test Succeeded.')
'';
};
};
}