nixos/tests/prosody: fix test prosody-mysql
This commit is contained in:
parent
3c5b611ee8
commit
e69f11b797
@ -2,37 +2,28 @@ let
|
||||
cert =
|
||||
pkgs:
|
||||
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=uploads.example.com/CN=conference.example.com' -days 36500
|
||||
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"
|
||||
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
|
||||
pkgs.writeShellScriptBin "create-prosody-users" ''
|
||||
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
|
||||
pkgs.writeShellScriptBin "delete-prosody-users" ''
|
||||
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
|
||||
'';
|
||||
@ -49,20 +40,20 @@ import ../make-test-python.nix {
|
||||
}:
|
||||
{
|
||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||
console.keyMap = "fr-bepo";
|
||||
networking.extraHosts = ''
|
||||
${nodes.server.config.networking.primaryIPAddress} example.com
|
||||
${nodes.server.config.networking.primaryIPAddress} conference.example.com
|
||||
${nodes.server.config.networking.primaryIPAddress} uploads.example.com
|
||||
${nodes.server.networking.primaryIPAddress} example.com
|
||||
${nodes.server.networking.primaryIPAddress} conference.example.com
|
||||
${nodes.server.networking.primaryIPAddress} uploads.example.com
|
||||
'';
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage ./xmpp-sendmessage.nix {
|
||||
connectTo = nodes.server.config.networking.primaryIPAddress;
|
||||
connectTo = nodes.server.networking.primaryIPAddress;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
server =
|
||||
{ config, pkgs, ... }:
|
||||
{ nodes, pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
@ -72,11 +63,10 @@ import ../make-test-python.nix {
|
||||
})
|
||||
];
|
||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||
console.keyMap = "fr-bepo";
|
||||
networking.extraHosts = ''
|
||||
${config.networking.primaryIPAddress} example.com
|
||||
${config.networking.primaryIPAddress} conference.example.com
|
||||
${config.networking.primaryIPAddress} uploads.example.com
|
||||
${nodes.server.networking.primaryIPAddress} example.com
|
||||
${nodes.server.networking.primaryIPAddress} conference.example.com
|
||||
${nodes.server.networking.primaryIPAddress} uploads.example.com
|
||||
'';
|
||||
networking.firewall.enable = false;
|
||||
environment.systemPackages = [
|
||||
@ -98,7 +88,7 @@ import ../make-test-python.nix {
|
||||
domain = "conference.example.com";
|
||||
}
|
||||
];
|
||||
uploadHttp = {
|
||||
httpFileShare = {
|
||||
domain = "uploads.example.com";
|
||||
};
|
||||
extraConfig = ''
|
||||
@ -131,16 +121,15 @@ import ../make-test-python.nix {
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
''
|
||||
# Check with mysql storage
|
||||
mysql.wait_for_unit("mysql.service")
|
||||
server.wait_for_unit("prosody.service")
|
||||
server.succeed('prosodyctl status | grep "Prosody is running"')
|
||||
testScript = _: ''
|
||||
# Check with mysql storage
|
||||
start_all()
|
||||
mysql.wait_for_unit("mysql.service")
|
||||
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")
|
||||
'';
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ in
|
||||
luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
|
||||
variables = {
|
||||
MYSQL_INCDIR = "${lib.getDev libmysqlclient}/include/";
|
||||
MYSQL_LIBDIR = "${lib.getLib libmysqlclient}/lib/";
|
||||
MYSQL_LIBDIR = "${lib.getLib libmysqlclient}/lib//mysql/";
|
||||
};
|
||||
};
|
||||
buildInputs = oa.buildInputs ++ [
|
||||
|
Loading…
x
Reference in New Issue
Block a user