Skip to content

Commit

Permalink
chairman service: propagate failure properly
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Nov 18, 2019
1 parent 7b2ab3c commit 841f40a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions nix/nixos/cardano-cluster-service.nix
Expand Up @@ -147,6 +147,7 @@ in {
delegationCertificate = pbft-cert-shexpr;
signingKey = pbft-sig-key-shexpr;
nodeId = "$1";
runtimeDir = null;
inherit genesisFile;
environment = "mainnet-ci";
protover-major = 0;
Expand Down
10 changes: 7 additions & 3 deletions nix/nixos/chairman-as-a-service.nix
Expand Up @@ -21,7 +21,6 @@ let
"${ncfg.package}/bin/chairman"
"--${ncfg.consensusProtocol}"
(nodeIdArgs)
"--core-node-id ${toString cfg.timeout}"
"--timeout ${toString cfg.timeout}"
"--max-block-no ${toString cfg.maxBlockNo}"
"--security-param ${toString cfg.k}"
Expand All @@ -32,10 +31,15 @@ let
"${lib.optionalString (cfg.pbftThreshold != null) "--pbft-signature-threshold ${cfg.pbftThreshold}"}"
];
in ''
set +e
echo "Starting ${exec}: '' + concatStringsSep "\"\n echo \"" cmd + ''"
echo "..or, once again, in a signle line:"
echo "..or, once again, in a single line:"
echo "'' + concatStringsSep " " cmd + ''"
exec '' + concatStringsSep " " cmd;
'' + concatStringsSep " " cmd + ''
status=$?
echo chairman returned status: $status
exit $status'';
in {
options = with types; {
services.chairman = {
Expand Down
8 changes: 3 additions & 5 deletions nix/nixos/tests/chairmans-cluster.nix
Expand Up @@ -27,7 +27,7 @@ let
chairman-runner = svcLib.mkChairmanScript {
inherit cardano-cluster-config;
chairman-config = {
timeout = 300;
timeout = 10;
maxBlockNo = 30;
};
};
Expand Down Expand Up @@ -88,13 +88,11 @@ in {
$machine->waitUntilSucceeds("nc -z 127.1.0.9 5555");
$machine->waitUntilSucceeds("nc -z 127.1.0.9 7777");
# $machine->succeed("bash -c 'tail -n 100 -f /var/lib/cardano-node/c-a-1/node.json | systemd-cat --identifier=json-c-a-1 --priority=crit' &");
# $machine->succeed("bash -c 'tail -n 100 -f /var/lib/cardano-node/c-a-2/node.json | systemd-cat --identifier=json-c-a-2 --priority=crit' &");
# $machine->succeed("bash -c 'tail -n 100 -f /var/lib/cardano-node/c-b-1/node.json | systemd-cat --identifier=json-c-b-1 --priority=crit' &");
# $machine->succeed("bash -c 'tail -n 100 -f /var/lib/cardano-node/c-b-2/node.json | systemd-cat --identifier=json-c-b-2 --priority=crit' &");
$machine->succeed("ip r l | systemd-cat --identifier=routing");
$machine->succeed("cat /etc/resolv.conf | systemd-cat --identifier=resolv");
$machine->succeed("netstat -pltn | grep LISTEN | systemd-cat --identifier=netstat");
$machine->succeed("${chairman-runner} 2>&1 | systemd-cat --identifier=chairman --priority=crit");
$machine->succeed("ls -l /var/lib/cardano-node/*.socket | systemd-cat --identifier=sockets");
$machine->succeed("bash -c 'set -o pipefail; { ${chairman-runner} 2>&1; status=\$?; echo END-OF-CHAIRMAN-OUTPUT-MARKER; sleep 3; exit \$status; } | systemd-cat --identifier=chairman --priority=crit'");
'' + optionalString interactive
''
$machine->waitUntilSucceeds("netstat -ptn | grep ESTABLISHED | systemd-cat --identifier=netstat --priority=crit; sleep 9s; false");
Expand Down

0 comments on commit 841f40a

Please sign in to comment.