summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTom Fitzhenry <tom@tom-fitzhenry.me.uk>2019-10-23 01:20:56 +1100
committerTom Fitzhenry <tom@tom-fitzhenry.me.uk>2019-10-26 00:57:54 +1100
commit6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5 (patch)
treed7cffb8b97c6c25ea09d9ccf0ce793d45f08de25 /nixos
parent230fc22e610a975162cc1eaf23aa6bd641b51d3d (diff)
downloadnixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar.gz
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar.bz2
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar.lz
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar.xz
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.tar.zst
nixpkgs-6d90d17a96fd4270cdff9d01efb90d6f2f86a8f5.zip
openarena: add test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/openarena.nix36
2 files changed, 37 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index e94c9712cbf..163a9815f2c 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -201,6 +201,7 @@ in
   novacomd = handleTestOn ["x86_64-linux"] ./novacomd.nix {};
   nsd = handleTest ./nsd.nix {};
   nzbget = handleTest ./nzbget.nix {};
+  openarena = handleTest ./openarena.nix {};
   openldap = handleTest ./openldap.nix {};
   opensmtpd = handleTest ./opensmtpd.nix {};
   openssh = handleTest ./openssh.nix {};
diff --git a/nixos/tests/openarena.nix b/nixos/tests/openarena.nix
new file mode 100644
index 00000000000..4cc4db22963
--- /dev/null
+++ b/nixos/tests/openarena.nix
@@ -0,0 +1,36 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "openarena";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ tomfitzhenry ];
+  };
+
+  machine =
+    { pkgs, ... }:
+
+    { imports = [];
+      environment.systemPackages = with pkgs; [
+        socat
+      ];
+      services.openarena = {
+        enable = true;
+        extraFlags = [
+          "+set dedicated 2"
+          "+set sv_hostname 'My NixOS server'"
+          "+map oa_dm1"
+        ];
+      };
+    };
+
+  testScript =
+    ''
+      $machine->waitForUnit("openarena.service");
+      $machine->waitUntilSucceeds("ss --numeric --udp --listening | grep -q 27960");
+
+      # The log line containing 'resolve address' is last and only message that occurs after
+      # the server starts accepting clients.
+      $machine->waitUntilSucceeds("journalctl -u openarena.service | grep 'resolve address: dpmaster.deathmask.net'");
+
+      # Check it's possible to join the server.
+      $machine->succeed("echo -n -e '\\xff\\xff\\xff\\xffgetchallenge' | socat - UDP4-DATAGRAM:127.0.0.1:27960 | grep -q challengeResponse");
+    '';
+})