2019-06-15 10:16:28 +01:00
|
|
|
import ../make-test.nix {
|
2018-03-21 13:27:20 +00:00
|
|
|
name = "prosody";
|
|
|
|
|
2019-06-15 10:41:50 +01:00
|
|
|
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
|
2018-09-23 09:46:22 +01:00
|
|
|
'';
|
2019-06-15 10:41:50 +01:00
|
|
|
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;
|
|
|
|
};
|
2019-04-17 22:36:07 +01:00
|
|
|
};
|
2018-03-21 13:27:20 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-06-15 10:41:50 +01:00
|
|
|
testScript = { nodes, ... }: ''
|
|
|
|
$server->waitForUnit('prosody.service');
|
|
|
|
$server->succeed('prosodyctl status') =~ /Prosody is running/;
|
2018-03-21 13:27:20 +00:00
|
|
|
|
2019-04-17 22:36:07 +01:00
|
|
|
# set password to 'nothunter2' (it's asked twice)
|
2019-06-15 10:41:50 +01:00
|
|
|
$server->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com');
|
2018-03-21 13:27:20 +00:00
|
|
|
# set password to 'y'
|
2019-06-15 10:41:50 +01:00
|
|
|
$server->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
2019-04-17 22:36:07 +01:00
|
|
|
# correct password to 'hunter2'
|
2019-06-15 10:41:50 +01:00
|
|
|
$server->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com');
|
2018-03-21 13:27:20 +00:00
|
|
|
|
2019-06-15 10:41:50 +01:00
|
|
|
$client->succeed("send-message");
|
2018-03-21 13:27:20 +00:00
|
|
|
|
2019-06-15 10:41:50 +01:00
|
|
|
$server->succeed('prosodyctl deluser cthon98@example.com');
|
|
|
|
$server->succeed('prosodyctl deluser azurediamond@example.com');
|
2018-03-21 13:27:20 +00:00
|
|
|
'';
|
|
|
|
}
|