nixos/bpftune: init basic test

This commit is contained in:
Nick Cao 2023-06-29 10:43:06 +08:00
parent b47c483bf8
commit 4cd70e125d
No known key found for this signature in database
3 changed files with 43 additions and 0 deletions

View file

@ -138,6 +138,7 @@ in {
borgbackup = handleTest ./borgbackup.nix {};
botamusique = handleTest ./botamusique.nix {};
bpf = handleTestOn ["x86_64-linux" "aarch64-linux"] ./bpf.nix {};
bpftune = handleTest ./bpftune.nix {};
breitbandmessung = handleTest ./breitbandmessung.nix {};
brscan5 = handleTest ./brscan5.nix {};
btrbk = handleTest ./btrbk.nix {};

37
nixos/tests/bpftune.nix Normal file
View file

@ -0,0 +1,37 @@
import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "bpftune";
meta = {
maintainers = with lib.maintainers; [ nickcao ];
};
nodes = {
client = { pkgs, ... }: {
services.bpftune.enable = true;
boot.kernel.sysctl."net.ipv4.tcp_rmem" = "4096 131072 1310720";
environment.systemPackages = [ pkgs.iperf3 ];
};
server = { ... }: {
services.iperf3 = {
enable = true;
openFirewall = true;
};
};
};
testScript = ''
with subtest("bpftune startup"):
client.wait_for_unit("bpftune.service")
client.wait_for_console_text("bpftune works fully")
with subtest("bpftune tcp buffer size"):
server.wait_for_unit("iperf3.service")
client.succeed("iperf3 --reverse -c server")
client.wait_for_console_text("need to increase TCP buffer size")
'';
})

View file

@ -7,6 +7,7 @@
, libbpf
, libcap
, libnl
, nixosTests
}:
stdenv.mkDerivation rec {
@ -55,6 +56,10 @@ stdenv.mkDerivation rec {
"stackprotector"
];
passthru.tests = {
inherit (nixosTests) bpftune;
};
meta = with lib; {
description = "BPF-based auto-tuning of Linux system parameters";
homepage = "https://github.com/oracle-samples/bpftune";