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