about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2023-06-29 10:43:06 +0800
committerNick Cao <nickcao@nichi.co>2023-07-17 15:59:50 +0800
commit4cd70e125d1baabb0846bdbfd4d87cf69e5fed8a (patch)
treecbee56a736675f4b817cd03785275e8ae5aa6a20 /nixos
parentb47c483bf8860ac9dbcc7d72a80f98bfd2b1584a (diff)
nixos/bpftune: init basic test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/bpftune.nix37
2 files changed, 38 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 723b030072e19..5f4aefad890f8 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -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 {};
diff --git a/nixos/tests/bpftune.nix b/nixos/tests/bpftune.nix
new file mode 100644
index 0000000000000..63fcfc8b81997
--- /dev/null
+++ b/nixos/tests/bpftune.nix
@@ -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")
+  '';
+
+})