mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #63150 from Izorkin/prosody-test
nixos/tests/prosody: update prosody tests
This commit is contained in:
commit
0f32b32c95
7 changed files with 128 additions and 41 deletions
|
@ -74,7 +74,7 @@ in
|
||||||
#ec2-config = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-config or {};
|
#ec2-config = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-config or {};
|
||||||
ec2-nixops = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-nixops or {};
|
ec2-nixops = (handleTestOn ["x86_64-linux"] ./ec2.nix {}).boot-ec2-nixops or {};
|
||||||
ecryptfs = handleTest ./ecryptfs.nix {};
|
ecryptfs = handleTest ./ecryptfs.nix {};
|
||||||
ejabberd = handleTest ./ejabberd.nix {};
|
ejabberd = handleTest ./xmpp/ejabberd.nix {};
|
||||||
elk = handleTestOn ["x86_64-linux"] ./elk.nix {};
|
elk = handleTestOn ["x86_64-linux"] ./elk.nix {};
|
||||||
env = handleTest ./env.nix {};
|
env = handleTest ./env.nix {};
|
||||||
etcd = handleTestOn ["x86_64-linux"] ./etcd.nix {};
|
etcd = handleTestOn ["x86_64-linux"] ./etcd.nix {};
|
||||||
|
@ -221,7 +221,8 @@ in
|
||||||
prometheus = handleTest ./prometheus.nix {};
|
prometheus = handleTest ./prometheus.nix {};
|
||||||
prometheus2 = handleTest ./prometheus-2.nix {};
|
prometheus2 = handleTest ./prometheus-2.nix {};
|
||||||
prometheus-exporters = handleTest ./prometheus-exporters.nix {};
|
prometheus-exporters = handleTest ./prometheus-exporters.nix {};
|
||||||
prosody = handleTest ./prosody.nix {};
|
prosody = handleTest ./xmpp/prosody.nix {};
|
||||||
|
prosodyMysql = handleTest ./xmpp/prosody-mysql.nix {};
|
||||||
proxy = handleTest ./proxy.nix {};
|
proxy = handleTest ./proxy.nix {};
|
||||||
quagga = handleTest ./quagga.nix {};
|
quagga = handleTest ./quagga.nix {};
|
||||||
quake3 = handleTest ./quake3.nix {};
|
quake3 = handleTest ./quake3.nix {};
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
import ./make-test.nix {
|
|
||||||
name = "prosody";
|
|
||||||
|
|
||||||
machine = { pkgs, ... }: {
|
|
||||||
services.prosody = {
|
|
||||||
enable = true;
|
|
||||||
# TODO: use a self-signed certificate
|
|
||||||
c2sRequireEncryption = false;
|
|
||||||
extraConfig = ''
|
|
||||||
storage = "sql"
|
|
||||||
'';
|
|
||||||
virtualHosts.test = {
|
|
||||||
domain = "example.com";
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
environment.systemPackages = [
|
|
||||||
(pkgs.callPackage ./xmpp-sendmessage.nix {})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
testScript = ''
|
|
||||||
$machine->waitForUnit('prosody.service');
|
|
||||||
$machine->succeed('prosodyctl status') =~ /Prosody is running/;
|
|
||||||
|
|
||||||
# set password to 'nothunter2' (it's asked twice)
|
|
||||||
$machine->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com');
|
|
||||||
# set password to 'y'
|
|
||||||
$machine->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
|
||||||
# correct password to 'hunter2'
|
|
||||||
$machine->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com');
|
|
||||||
|
|
||||||
$machine->succeed("send-message");
|
|
||||||
|
|
||||||
$machine->succeed('prosodyctl deluser cthon98@example.com');
|
|
||||||
$machine->succeed('prosodyctl deluser azurediamond@example.com');
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
import ./make-test.nix ({ pkgs, ... }: {
|
import ../make-test.nix ({ pkgs, ... }: {
|
||||||
name = "ejabberd";
|
name = "ejabberd";
|
||||||
meta = with pkgs.stdenv.lib.maintainers; {
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
maintainers = [ ajs124 ];
|
maintainers = [ ajs124 ];
|
77
nixos/tests/xmpp/prosody-mysql.nix
Normal file
77
nixos/tests/xmpp/prosody-mysql.nix
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
import ../make-test.nix {
|
||||||
|
name = "prosody-mysql";
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
client = { nodes, pkgs, ... }: {
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
|
||||||
|
];
|
||||||
|
};
|
||||||
|
server = { config, pkgs, ... }: {
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(self: super: {
|
||||||
|
prosody = super.prosody.override {
|
||||||
|
withDBI = true;
|
||||||
|
withExtraLibs = [ pkgs.luaPackages.luadbi-mysql ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
networking.extraHosts = ''
|
||||||
|
${config.networking.primaryIPAddress} example.com
|
||||||
|
'';
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
services.prosody = {
|
||||||
|
enable = true;
|
||||||
|
# TODO: use a self-signed certificate
|
||||||
|
c2sRequireEncryption = false;
|
||||||
|
extraConfig = ''
|
||||||
|
storage = "sql"
|
||||||
|
sql = {
|
||||||
|
driver = "MySQL";
|
||||||
|
database = "prosody";
|
||||||
|
host = "mysql";
|
||||||
|
port = 3306;
|
||||||
|
username = "prosody";
|
||||||
|
password = "password123";
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
virtualHosts.test = {
|
||||||
|
domain = "example.com";
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
mysql = { config, pkgs, ... }: {
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
services.mysql = {
|
||||||
|
enable = true;
|
||||||
|
initialScript = pkgs.writeText "mysql_init.sql" ''
|
||||||
|
CREATE DATABASE prosody;
|
||||||
|
CREATE USER 'prosody'@'server' IDENTIFIED BY 'password123';
|
||||||
|
GRANT ALL PRIVILEGES ON prosody.* TO 'prosody'@'server';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
'';
|
||||||
|
package = pkgs.mariadb;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = { nodes, ... }: ''
|
||||||
|
$mysql->waitForUnit('mysql.service');
|
||||||
|
$server->waitForUnit('prosody.service');
|
||||||
|
$server->succeed('prosodyctl status') =~ /Prosody is running/;
|
||||||
|
|
||||||
|
# set password to 'nothunter2' (it's asked twice)
|
||||||
|
$server->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com');
|
||||||
|
# set password to 'y'
|
||||||
|
$server->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
||||||
|
# correct password to 'hunter2'
|
||||||
|
$server->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com');
|
||||||
|
|
||||||
|
$client->succeed("send-message");
|
||||||
|
|
||||||
|
$server->succeed('prosodyctl deluser cthon98@example.com');
|
||||||
|
$server->succeed('prosodyctl deluser azurediamond@example.com');
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
46
nixos/tests/xmpp/prosody.nix
Normal file
46
nixos/tests/xmpp/prosody.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import ../make-test.nix {
|
||||||
|
name = "prosody";
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
client = { nodes, pkgs, ... }: {
|
||||||
|
environment.systemPackages = [
|
||||||
|
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = nodes.server.config.networking.primaryIPAddress; })
|
||||||
|
];
|
||||||
|
};
|
||||||
|
server = { config, pkgs, ... }: {
|
||||||
|
networking.extraHosts = ''
|
||||||
|
${config.networking.primaryIPAddress} example.com
|
||||||
|
'';
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
services.prosody = {
|
||||||
|
enable = true;
|
||||||
|
# TODO: use a self-signed certificate
|
||||||
|
c2sRequireEncryption = false;
|
||||||
|
extraConfig = ''
|
||||||
|
storage = "sql"
|
||||||
|
'';
|
||||||
|
virtualHosts.test = {
|
||||||
|
domain = "example.com";
|
||||||
|
enabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = { nodes, ... }: ''
|
||||||
|
$server->waitForUnit('prosody.service');
|
||||||
|
$server->succeed('prosodyctl status') =~ /Prosody is running/;
|
||||||
|
|
||||||
|
# set password to 'nothunter2' (it's asked twice)
|
||||||
|
$server->succeed('yes nothunter2 | prosodyctl adduser cthon98@example.com');
|
||||||
|
# set password to 'y'
|
||||||
|
$server->succeed('yes | prosodyctl adduser azurediamond@example.com');
|
||||||
|
# correct password to 'hunter2'
|
||||||
|
$server->succeed('yes hunter2 | prosodyctl passwd azurediamond@example.com');
|
||||||
|
|
||||||
|
$client->succeed("send-message");
|
||||||
|
|
||||||
|
$server->succeed('prosodyctl deluser cthon98@example.com');
|
||||||
|
$server->succeed('prosodyctl deluser azurediamond@example.com');
|
||||||
|
'';
|
||||||
|
}
|
|
@ -14508,6 +14508,7 @@ in
|
||||||
prosody = callPackage ../servers/xmpp/prosody {
|
prosody = callPackage ../servers/xmpp/prosody {
|
||||||
# _compat can probably be removed on next minor version after 0.10.0
|
# _compat can probably be removed on next minor version after 0.10.0
|
||||||
lua5 = lua5_2_compat;
|
lua5 = lua5_2_compat;
|
||||||
|
withExtraLibs = [ luaPackages.luadbi-sqlite3 ];
|
||||||
inherit (lua52Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent luadbi;
|
inherit (lua52Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent luadbi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue