snapshot store: test the sender deadlines and the receiver bounds
open_stream takes its deadlines as parameters so the tests can use short ones. The header-write test connects to a peer that holds the connection without reading and sends a header larger than any loopback buffer; the connect deadline is tested through the shared bounded helper with a future that never completes, since a connect that hangs is not reproducible without the network. The module-eval case asserts the unit's RuntimeMaxSec and that the receiver script reads its header with a timeout.
This commit is contained in:
parent
b03549fde6
commit
7b50ae57e4
2 changed files with 110 additions and 22 deletions
|
|
@ -3,7 +3,8 @@
|
|||
# executes").
|
||||
#
|
||||
# The snapshot store's receiver socket: where it listens, that it can bind
|
||||
# before the mesh interface is up, and that it refuses a wildcard.
|
||||
# before the mesh interface is up, that it refuses a wildcard, and that a
|
||||
# silent or stalled transfer is bounded.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -46,6 +47,10 @@ let
|
|||
snapshotStore.enable = true;
|
||||
};
|
||||
|
||||
unit = store.systemd.services."swarm-snapshot-store@";
|
||||
|
||||
moduleSource = builtins.readFile ../host-modules/swarm-snapshot-store.nix;
|
||||
|
||||
socket = store.systemd.sockets.swarm-snapshot-store.socketConfig;
|
||||
|
||||
refusedAsWildcard =
|
||||
|
|
@ -80,6 +85,18 @@ let
|
|||
name = "a wildcard mesh address, IPv4 or IPv6, is refused";
|
||||
ok = refusedAsWildcard storeOnWildcard && refusedAsWildcard storeOnWildcardV6;
|
||||
}
|
||||
{
|
||||
# Without it a stalled `btrfs receive` holds a root instance forever.
|
||||
name = "the receiver unit has a runtime ceiling";
|
||||
ok = unit.serviceConfig.RuntimeMaxSec or null == "6h";
|
||||
}
|
||||
{
|
||||
# The script is a store path, so its text is not evaluable without
|
||||
# building it; the module source is the nearest thing to read. A
|
||||
# silent peer must not hold the root instance past the header read.
|
||||
name = "the receiver script bounds its header read";
|
||||
ok = lib.hasInfix "read -r -t \${toString headerTimeoutSeconds} keyword agent" moduleSource;
|
||||
}
|
||||
];
|
||||
in
|
||||
runGroup "snapshot-store" cases
|
||||
|
|
|
|||
Loading…
Reference in a new issue