nixos/ejabberd: Port test to python

This commit is contained in:
Jacek Galowicz 2019-11-26 10:03:12 +01:00
parent ba85932bae
commit 76605b2127

View file

@ -1,4 +1,4 @@
import ../make-test.nix ({ pkgs, ... }: {
import ../make-test-python.nix ({ pkgs, ... }: {
name = "ejabberd";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ ajs124 ];
@ -248,13 +248,21 @@ import ../make-test.nix ({ pkgs, ... }: {
};
testScript = { nodes, ... }: ''
$server->waitForUnit('ejabberd.service');
$server->succeed('su ejabberd -s $(which ejabberdctl) status|grep started') =~ /ejabberd is running/;
$server->succeed('su ejabberd -s $(which ejabberdctl) register azurediamond example.com hunter2');
$server->succeed('su ejabberd -s $(which ejabberdctl) register cthon98 example.com nothunter2');
$server->fail('su ejabberd -s $(which ejabberdctl) register asdf wrong.domain');
$client->succeed('send-message');
$server->succeed('su ejabberd -s $(which ejabberdctl) unregister cthon98 example.com');
$server->succeed('su ejabberd -s $(which ejabberdctl) unregister azurediamond example.com');
ejabberd_prefix = "su ejabberd -s $(which ejabberdctl) "
server.wait_for_unit("ejabberd.service")
assert "status: started" in server.succeed(ejabberd_prefix + "status")
server.succeed(
ejabberd_prefix + "register azurediamond example.com hunter2",
ejabberd_prefix + "register cthon98 example.com nothunter2",
)
server.fail(ejabberd_prefix + "register asdf wrong.domain")
client.succeed("send-message")
server.succeed(
ejabberd_prefix + "unregister cthon98 example.com",
ejabberd_prefix + "unregister azurediamond example.com",
)
'';
})