Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 24.11] velocity: init at 3.4.0-unstable-2025-02-28 #388744

Merged
merged 3 commits into from
Mar 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
@@ -1108,6 +1108,7 @@ in {
vault-postgresql = handleTest ./vault-postgresql.nix {};
vaultwarden = discoverTests (import ./vaultwarden.nix);
vector = handleTest ./vector {};
velocity = runTest ./velocity.nix;
vengi-tools = handleTest ./vengi-tools.nix {};
victoriametrics = handleTest ./victoriametrics.nix {};
vikunja = handleTest ./vikunja.nix {};
68 changes: 68 additions & 0 deletions nixos/tests/velocity.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ lib, pkgs, ... }:
{
name = "velocity";
meta = {
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = [ lib.maintainers.Tert0 ];
};

nodes.server =
{ ... }:
{
imports =
let
mkVelocityService = name: pkg: {
systemd.sockets.${name} = {
socketConfig = {
ListenFIFO = "/run/${name}.stdin";
Service = "${name}";
};
};
systemd.services.${name} = {
serviceConfig = {
ExecStart = "${pkg}/bin/velocity";
DynamicUser = true;
StateDirectory = "${name}";
WorkingDirectory = "/var/lib/${name}";

Sockets = "${name}.socket";
StandardInput = "socket";
StandardOutput = "journal";
StandardError = "journal";
};
};
};
in
[
(mkVelocityService "velocity-without-native" (
pkgs.velocity.override { withVelocityNative = false; }
))
(mkVelocityService "velocity-with-native" (pkgs.velocity.override { withVelocityNative = true; }))
];

environment.systemPackages = [ pkgs.mcstatus ];
};

testScript = ''
def test_velocity(name: str, native: bool):
server.start_job(name)
server.wait_for_unit(name);
server.wait_for_open_port(25565)
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q 'Booting up Velocity nixpkgs-${pkgs.velocity.version}...'")
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"
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q -E '{connections_startup_query}'")
server.wait_until_succeeds(f"journalctl -b -u {name} | grep -q 'Done ([0-9]*.[0-9]*s)!'");

_, status_result = server.execute("mcstatus localhost:25565 status")
assert "A Velocity Server" in status_result

server.execute(f"echo stop > /run/{name}.stdin")
server.wait_for_closed_port(25565);

test_velocity("velocity-without-native", False)
test_velocity("velocity-with-native", True)
'';
}
Loading