diff --git a/nixos/tests/xmpp/prosody.nix b/nixos/tests/xmpp/prosody.nix index 3241cee79c9a..8331c7b6d331 100644 --- a/nixos/tests/xmpp/prosody.nix +++ b/nixos/tests/xmpp/prosody.nix @@ -1,38 +1,46 @@ import ../make-test.nix { name = "prosody"; - machine = { pkgs, ... }: { - services.prosody = { - enable = true; - # TODO: use a self-signed certificate - c2sRequireEncryption = false; - extraConfig = '' - storage = "sql" + nodes = { + client = { nodes, pkgs, ... }: { + environment.systemPackages = [ + (pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; }) + ]; + }; + server = { config, pkgs, ... }: { + networking.extraHosts = '' + ${config.networking.primaryIPAddress} example.com ''; - virtualHosts.test = { - domain = "example.com"; - enabled = true; + networking.firewall.enable = false; + services.prosody = { + enable = true; + # TODO: use a self-signed certificate + c2sRequireEncryption = false; + extraConfig = '' + storage = "sql" + ''; + virtualHosts.test = { + domain = "example.com"; + enabled = true; + }; }; }; - environment.systemPackages = [ - (pkgs.callPackage ./xmpp-sendmessage.nix {}) - ]; }; - testScript = '' - $machine->waitForUnit('prosody.service'); - $machine->succeed('prosodyctl status') =~ /Prosody is running/; + testScript = { nodes, ... }: '' + $server->waitForUnit('prosody.service'); + $server->succeed('prosodyctl status') =~ /Prosody is running/; # set password to 'nothunter2' (it's asked twice) - $machine->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com'); + $server->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com'); # set password to 'y' - $machine->succeed('yes | prosodyctl adduser azurediamond@example.com'); + $server->succeed('yes | prosodyctl adduser azurediamond@example.com'); # correct password to 'hunter2' - $machine->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com'); + $server->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com'); - $machine->succeed("send-message"); + $client->succeed("send-message"); - $machine->succeed('prosodyctl deluser cthon98@example.com'); - $machine->succeed('prosodyctl deluser azurediamond@example.com'); + $server->succeed('prosodyctl deluser cthon98@example.com'); + $server->succeed('prosodyctl deluser azurediamond@example.com'); ''; }