nixos/tests/prosody: misc cleanup

This commit is contained in:
Sandro Jäckel
2025-08-03 21:35:31 +02:00
parent 404f32129e
commit e406b1f7dc
+17 -26
View File
@@ -7,33 +7,26 @@ let
mkdir -p $out
cp key.pem cert.pem $out
'';
# Creates and set password for the 2 xmpp test users.
#
# Doing that in a bash script instead of doing that in the test
# script allow us to easily provision the users when running that
# test interactively.
createUsers =
pkgs:
pkgs.writeScriptBin "create-prosody-users" ''
#!${pkgs.bash}/bin/bash
set -e
# Creates and set password for the 2 xmpp test users.
#
# Doing that in a bash script instead of doing that in the test
# script allow us to easily provision the users when running that
# test interactively.
prosodyctl register cthon98 example.com nothunter2
prosodyctl register azurediamond example.com hunter2
'';
# Deletes the test users.
delUsers =
pkgs:
pkgs.writeScriptBin "delete-prosody-users" ''
#!${pkgs.bash}/bin/bash
set -e
# Deletes the test users.
#
# Doing that in a bash script instead of doing that in the test
# script allow us to easily provision the users when running that
# test interactively.
prosodyctl deluser cthon98@example.com
prosodyctl deluser azurediamond@example.com
'';
@@ -45,7 +38,6 @@ import ../make-test-python.nix {
{
nodes,
pkgs,
config,
...
}:
{
@@ -60,6 +52,7 @@ import ../make-test-python.nix {
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = "example.com"; })
];
};
server =
{ config, pkgs, ... }:
{
@@ -97,16 +90,14 @@ import ../make-test-python.nix {
};
};
testScript =
{ nodes, ... }:
''
# Check with sqlite storage
start_all()
server.wait_for_unit("prosody.service")
server.succeed('prosodyctl status | grep "Prosody is running"')
testScript = _: ''
# Check with sqlite storage
start_all()
server.wait_for_unit("prosody.service")
server.succeed('prosodyctl status | grep "Prosody is running"')
server.succeed("create-prosody-users")
client.succeed("send-message")
server.succeed("delete-prosody-users")
'';
server.succeed("create-prosody-users")
client.succeed("send-message")
server.succeed("delete-prosody-users")
'';
}