12 import ./make-test-python.nix ({ pkgs, lib, ... }: {
16 networking.firewall.allowedTCPPorts = [ ircPort ];
20 The default MOTD doesn't contain the word "nixos" in it.
25 } // lib.listToAttrs (builtins.map (client: lib.nameValuePair client {
27 ./common/user-account.nix
30 systemd.services.ii = {
31 requires = [ "network.target" ];
32 wantedBy = [ "default.target" ];
36 ExecPreStartPre = "mkdir -p ${iiDir}";
38 ${lib.getBin pkgs.ii}/bin/ii -n ${client} -s ${server} -i ${iiDir}
47 msg = client: "Hello, my name is ${client}";
48 clientScript = client: [
50 ${client}.wait_for_unit("network.target")
51 ${client}.systemctl("start ii")
52 ${client}.wait_for_unit("ii")
53 ${client}.wait_for_file("${iiDir}/${server}/out")
55 # look for the custom text in the MOTD.
57 ${client}.wait_until_succeeds("grep 'nixos' ${iiDir}/${server}/out")
59 # wait until first PING from server arrives before joining,
60 # so we don't try it too early
62 ${client}.wait_until_succeeds("grep 'PING' ${iiDir}/${server}/out")
66 ${client}.succeed("echo '/j #${channel}' > ${iiDir}/${server}/in")
67 ${client}.wait_for_file("${iiDir}/${server}/#${channel}/in")
72 "echo '${msg client}' > ${iiDir}/${server}/#${channel}/in"
75 # check that all greetings arrived on all clients
76 ] ++ builtins.map (other: ''
78 "grep '${msg other}$' ${iiDir}/${server}/#${channel}/out"
82 # foldl', but requires a non-empty list instead of a start value
84 builtins.foldl' f (builtins.head list) (builtins.tail list);
87 ${server}.systemctl("status solanum")
88 ${server}.wait_for_open_port(${toString ircPort})
90 # run clientScript for all clients so that every list
91 # entry is executed by every client before advancing
93 '' + lib.concatStrings
95 (lib.zipListsWith (cs: c: cs + c))
96 (builtins.map clientScript clients));