Merge pull request #202491 from NinjaTrappeur/nin/fix-prosody-test
Fixes https://github.com/NixOS/nixpkgs/issues/202458
This commit is contained in:
@@ -42,7 +42,7 @@ in import ../make-test-python.nix {
|
||||
${nodes.server.config.networking.primaryIPAddress} uploads.example.com
|
||||
'';
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
|
||||
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = "example.com"; })
|
||||
];
|
||||
};
|
||||
server = { config, pkgs, ... }: {
|
||||
@@ -82,6 +82,7 @@ in 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"')
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ in writeScriptBin "send-message" ''
|
||||
#!${(python3.withPackages (ps: [ ps.slixmpp ])).interpreter}
|
||||
import logging
|
||||
import sys
|
||||
import signal
|
||||
from types import MethodType
|
||||
|
||||
from slixmpp import ClientXMPP
|
||||
@@ -64,8 +65,13 @@ class CthonTest(ClientXMPP):
|
||||
log.info('MUC join success!')
|
||||
log.info('XMPP SCRIPT TEST SUCCESS')
|
||||
|
||||
def timeout_handler(signalnum, stackframe):
|
||||
print('ERROR: xmpp-sendmessage timed out')
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
signal.signal(signal.SIGALRM, timeout_handler)
|
||||
signal.alarm(120)
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
format='%(levelname)-8s %(message)s')
|
||||
|
||||
@@ -76,7 +82,7 @@ if __name__ == '__main__':
|
||||
ct.register_plugin('xep_0363')
|
||||
# MUC
|
||||
ct.register_plugin('xep_0045')
|
||||
ct.connect(("server", 5222))
|
||||
ct.connect(("${connectTo}", 5222))
|
||||
ct.process(forever=False)
|
||||
|
||||
if not ct.test_succeeded:
|
||||
|
||||
Reference in New Issue
Block a user