nixos/tests/prosody: checking work prosody through local network
This commit is contained in:
parent
691da63cba
commit
e328ea9c11
@ -1,38 +1,46 @@
|
|||||||
import ../make-test.nix {
|
import ../make-test.nix {
|
||||||
name = "prosody";
|
name = "prosody";
|
||||||
|
|
||||||
machine = { pkgs, ... }: {
|
nodes = {
|
||||||
services.prosody = {
|
client = { nodes, pkgs, ... }: {
|
||||||
enable = true;
|
environment.systemPackages = [
|
||||||
# TODO: use a self-signed certificate
|
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
|
||||||
c2sRequireEncryption = false;
|
];
|
||||||
extraConfig = ''
|
};
|
||||||
storage = "sql"
|
server = { config, pkgs, ... }: {
|
||||||
|
networking.extraHosts = ''
|
||||||
|
${config.networking.primaryIPAddress} example.com
|
||||||
'';
|
'';
|
||||||
virtualHosts.test = {
|
networking.firewall.enable = false;
|
||||||
domain = "example.com";
|
services.prosody = {
|
||||||
enabled = true;
|
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 = ''
|
testScript = { nodes, ... }: ''
|
||||||
$machine->waitForUnit('prosody.service');
|
$server->waitForUnit('prosody.service');
|
||||||
$machine->succeed('prosodyctl status') =~ /Prosody is running/;
|
$server->succeed('prosodyctl status') =~ /Prosody is running/;
|
||||||
|
|
||||||
# set password to 'nothunter2' (it's asked twice)
|
# 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'
|
# set password to 'y'
|
||||||
$machine->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
$server->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
||||||
# correct password to 'hunter2'
|
# 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');
|
$server->succeed('prosodyctl deluser cthon98@example.com');
|
||||||
$machine->succeed('prosodyctl deluser azurediamond@example.com');
|
$server->succeed('prosodyctl deluser azurediamond@example.com');
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user