tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/tests/prosody: fix test prosody-mysql
Izorkin
5 months ago
e69f11b7
3c5b611e
+31
-42
2 changed files
expand all
collapse all
unified
split
nixos
tests
xmpp
prosody-mysql.nix
pkgs
development
lua-modules
overrides.nix
+30
-41
nixos/tests/xmpp/prosody-mysql.nix
···
2
cert =
3
pkgs:
4
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
5
-
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
0
6
mkdir -p $out
7
cp key.pem cert.pem $out
8
'';
0
0
0
0
0
9
createUsers =
10
pkgs:
11
-
pkgs.writeScriptBin "create-prosody-users" ''
12
-
#!${pkgs.bash}/bin/bash
13
set -e
14
-
15
-
# Creates and set password for the 2 xmpp test users.
16
-
#
17
-
# Doing that in a bash script instead of doing that in the test
18
-
# script allow us to easily provision the users when running that
19
-
# test interactively.
20
-
21
prosodyctl register cthon98 example.com nothunter2
22
prosodyctl register azurediamond example.com hunter2
23
'';
0
24
delUsers =
25
pkgs:
26
-
pkgs.writeScriptBin "delete-prosody-users" ''
27
-
#!${pkgs.bash}/bin/bash
28
set -e
29
-
30
-
# Deletes the test users.
31
-
#
32
-
# Doing that in a bash script instead of doing that in the test
33
-
# script allow us to easily provision the users when running that
34
-
# test interactively.
35
-
36
prosodyctl deluser cthon98@example.com
37
prosodyctl deluser azurediamond@example.com
38
'';
···
49
}:
50
{
51
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
52
-
console.keyMap = "fr-bepo";
53
networking.extraHosts = ''
54
-
${nodes.server.config.networking.primaryIPAddress} example.com
55
-
${nodes.server.config.networking.primaryIPAddress} conference.example.com
56
-
${nodes.server.config.networking.primaryIPAddress} uploads.example.com
57
'';
58
environment.systemPackages = [
59
(pkgs.callPackage ./xmpp-sendmessage.nix {
60
-
connectTo = nodes.server.config.networking.primaryIPAddress;
61
})
62
];
63
};
0
64
server =
65
-
{ config, pkgs, ... }:
66
{
67
nixpkgs.overlays = [
68
(self: super: {
···
72
})
73
];
74
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
75
-
console.keyMap = "fr-bepo";
76
networking.extraHosts = ''
77
-
${config.networking.primaryIPAddress} example.com
78
-
${config.networking.primaryIPAddress} conference.example.com
79
-
${config.networking.primaryIPAddress} uploads.example.com
80
'';
81
networking.firewall.enable = false;
82
environment.systemPackages = [
···
98
domain = "conference.example.com";
99
}
100
];
101
-
uploadHttp = {
102
domain = "uploads.example.com";
103
};
104
extraConfig = ''
···
131
};
132
};
133
134
-
testScript =
135
-
{ nodes, ... }:
136
-
''
137
-
# Check with mysql storage
138
-
mysql.wait_for_unit("mysql.service")
139
-
server.wait_for_unit("prosody.service")
140
-
server.succeed('prosodyctl status | grep "Prosody is running"')
141
142
-
server.succeed("create-prosody-users")
143
-
client.succeed("send-message")
144
-
server.succeed("delete-prosody-users")
145
-
'';
146
}
···
2
cert =
3
pkgs:
4
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
5
+
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
6
+
-subj '/C=GB/CN=example.com' -addext "subjectAltName = DNS:example.com,DNS:uploads.example.com,DNS:conference.example.com"
7
mkdir -p $out
8
cp key.pem cert.pem $out
9
'';
10
+
# Creates and set password for the 2 xmpp test users.
11
+
#
12
+
# Doing that in a bash script instead of doing that in the test
13
+
# script allow us to easily provision the users when running that
14
+
# test interactively.
15
createUsers =
16
pkgs:
17
+
pkgs.writeShellScriptBin "create-prosody-users" ''
0
18
set -e
0
0
0
0
0
0
0
19
prosodyctl register cthon98 example.com nothunter2
20
prosodyctl register azurediamond example.com hunter2
21
'';
22
+
# Deletes the test users.
23
delUsers =
24
pkgs:
25
+
pkgs.writeShellScriptBin "delete-prosody-users" ''
0
26
set -e
0
0
0
0
0
0
0
27
prosodyctl deluser cthon98@example.com
28
prosodyctl deluser azurediamond@example.com
29
'';
···
40
}:
41
{
42
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
0
43
networking.extraHosts = ''
44
+
${nodes.server.networking.primaryIPAddress} example.com
45
+
${nodes.server.networking.primaryIPAddress} conference.example.com
46
+
${nodes.server.networking.primaryIPAddress} uploads.example.com
47
'';
48
environment.systemPackages = [
49
(pkgs.callPackage ./xmpp-sendmessage.nix {
50
+
connectTo = nodes.server.networking.primaryIPAddress;
51
})
52
];
53
};
54
+
55
server =
56
+
{ nodes, pkgs, ... }:
57
{
58
nixpkgs.overlays = [
59
(self: super: {
···
63
})
64
];
65
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
0
66
networking.extraHosts = ''
67
+
${nodes.server.networking.primaryIPAddress} example.com
68
+
${nodes.server.networking.primaryIPAddress} conference.example.com
69
+
${nodes.server.networking.primaryIPAddress} uploads.example.com
70
'';
71
networking.firewall.enable = false;
72
environment.systemPackages = [
···
88
domain = "conference.example.com";
89
}
90
];
91
+
httpFileShare = {
92
domain = "uploads.example.com";
93
};
94
extraConfig = ''
···
121
};
122
};
123
124
+
testScript = _: ''
125
+
# Check with mysql storage
126
+
start_all()
127
+
mysql.wait_for_unit("mysql.service")
128
+
server.wait_for_unit("prosody.service")
129
+
server.succeed('prosodyctl status | grep "Prosody is running"')
0
130
131
+
server.succeed("create-prosody-users")
132
+
client.succeed("send-message")
133
+
server.succeed("delete-prosody-users")
134
+
'';
135
}
+1
-1
pkgs/development/lua-modules/overrides.nix
···
453
luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
454
variables = {
455
MYSQL_INCDIR = "${lib.getDev libmysqlclient}/include/";
456
-
MYSQL_LIBDIR = "${lib.getLib libmysqlclient}/lib/";
457
};
458
};
459
buildInputs = oa.buildInputs ++ [
···
453
luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
454
variables = {
455
MYSQL_INCDIR = "${lib.getDev libmysqlclient}/include/";
456
+
MYSQL_LIBDIR = "${lib.getLib libmysqlclient}/lib//mysql/";
457
};
458
};
459
buildInputs = oa.buildInputs ++ [