tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/tests/velocity: init
Tert0
1 year ago
3f29dce6
30f82d2e
+69
2 changed files
expand all
collapse all
unified
split
nixos
tests
all-tests.nix
velocity.nix
+1
nixos/tests/all-tests.nix
reviewed
···
1211
1211
vault-postgresql = handleTest ./vault-postgresql.nix {};
1212
1212
vaultwarden = discoverTests (import ./vaultwarden.nix);
1213
1213
vector = handleTest ./vector {};
1214
1214
+
velocity = runTest ./velocity.nix;
1214
1215
vengi-tools = handleTest ./vengi-tools.nix {};
1215
1216
victoriametrics = handleTest ./victoriametrics {};
1216
1217
vikunja = handleTest ./vikunja.nix {};
+68
nixos/tests/velocity.nix
reviewed
···
1
1
+
{ lib, pkgs, ... }:
2
2
+
{
3
3
+
name = "velocity";
4
4
+
meta = {
5
5
+
platforms = [
6
6
+
"x86_64-linux"
7
7
+
"aarch64-linux"
8
8
+
];
9
9
+
maintainers = [ lib.maintainers.Tert0 ];
10
10
+
};
11
11
+
12
12
+
nodes.server =
13
13
+
{ ... }:
14
14
+
{
15
15
+
imports =
16
16
+
let
17
17
+
mkVelocityService = name: pkg: {
18
18
+
systemd.sockets.${name} = {
19
19
+
socketConfig = {
20
20
+
ListenFIFO = "/run/${name}.stdin";
21
21
+
Service = "${name}";
22
22
+
};
23
23
+
};
24
24
+
systemd.services.${name} = {
25
25
+
serviceConfig = {
26
26
+
ExecStart = "${pkg}/bin/velocity";
27
27
+
DynamicUser = true;
28
28
+
StateDirectory = "${name}";
29
29
+
WorkingDirectory = "/var/lib/${name}";
30
30
+
31
31
+
Sockets = "${name}.socket";
32
32
+
StandardInput = "socket";
33
33
+
StandardOutput = "journal";
34
34
+
StandardError = "journal";
35
35
+
};
36
36
+
};
37
37
+
};
38
38
+
in
39
39
+
[
40
40
+
(mkVelocityService "velocity-without-native" (
41
41
+
pkgs.velocity.override { withVelocityNative = false; }
42
42
+
))
43
43
+
(mkVelocityService "velocity-with-native" (pkgs.velocity.override { withVelocityNative = true; }))
44
44
+
];
45
45
+
46
46
+
environment.systemPackages = [ pkgs.mcstatus ];
47
47
+
};
48
48
+
49
49
+
testScript = ''
50
50
+
def test_velocity(name: str, native: bool):
51
51
+
server.start_job(name)
52
52
+
server.wait_for_unit(name);
53
53
+
server.wait_for_open_port(25565)
54
54
+
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q 'Booting up Velocity nixpkgs-${pkgs.velocity.version}...'")
55
55
+
connections_startup_query = "Connections will use epoll channels, libdeflate (.+) compression, OpenSSL 3.x.x (.+) ciphers" if native else "Connections will use epoll channels, Java compression, Java ciphers"
56
56
+
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q -E '{connections_startup_query}'")
57
57
+
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q 'Done ([0-9]*.[0-9]*s)!'");
58
58
+
59
59
+
_, status_result = server.execute("mcstatus localhost:25565 status")
60
60
+
assert "A Velocity Server" in status_result
61
61
+
62
62
+
server.execute(f"echo stop > /run/{name}.stdin")
63
63
+
server.wait_for_closed_port(25565);
64
64
+
65
65
+
test_velocity("velocity-without-native", False)
66
66
+
test_velocity("velocity-with-native", True)
67
67
+
'';
68
68
+
}