nixos/prosody: Integrate go-sendxmpp into test
This commit is contained in:
@@ -3,7 +3,7 @@ let
|
||||
pkgs:
|
||||
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
|
||||
-subj '/C=GB/CN=example.com' -addext "subjectAltName = DNS:example.com,DNS:uploads.example.com,DNS:conference.example.com"
|
||||
-subj '/C=GB/CN=example.com/CN=uploads.example.com/CN=conference.example.com' -addext "subjectAltName = DNS:example.com,DNS:uploads.example.com,DNS:conference.example.com"
|
||||
mkdir -p $out
|
||||
cp key.pem cert.pem $out
|
||||
'';
|
||||
@@ -32,7 +32,18 @@ in
|
||||
import ../make-test-python.nix {
|
||||
name = "prosody";
|
||||
nodes = {
|
||||
client =
|
||||
client-a =
|
||||
{ nodes, pkgs, ... }:
|
||||
{
|
||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||
networking.extraHosts = ''
|
||||
${nodes.server.networking.primaryIPAddress} example.com
|
||||
'';
|
||||
|
||||
imports = [ ./go-sendxmpp-listen.nix ];
|
||||
};
|
||||
|
||||
client-b =
|
||||
{
|
||||
nodes,
|
||||
pkgs,
|
||||
@@ -93,7 +104,18 @@ import ../make-test-python.nix {
|
||||
server.succeed('prosodyctl status | grep "Prosody is running"')
|
||||
|
||||
server.succeed("create-prosody-users")
|
||||
client.succeed("send-message")
|
||||
|
||||
for machine in client_a, client_b:
|
||||
machine.systemctl("start network-online.target")
|
||||
machine.wait_for_unit("network-online.target")
|
||||
|
||||
client_a.wait_for_unit("go-sendxmpp-listen")
|
||||
client_b.succeed("send-message")
|
||||
|
||||
client_a.wait_until_succeeds(
|
||||
"journalctl -o cat -u go-sendxmpp-listen.service | grep 'cthon98@example.com: Hello, this is dog.'"
|
||||
)
|
||||
|
||||
server.succeed("delete-prosody-users")
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user