From 8f6bea4ae9b6d8021ee65532acb33d91c3e28f0c Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Sun, 1 Dec 2019 01:34:37 +0100 Subject: [PATCH] nixosTests.openarena: port to python --- nixos/tests/openarena.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nixos/tests/openarena.nix b/nixos/tests/openarena.nix index 4cc4db229637..b315426532ba 100644 --- a/nixos/tests/openarena.nix +++ b/nixos/tests/openarena.nix @@ -1,4 +1,4 @@ -import ./make-test.nix ({ pkgs, ...} : { +import ./make-test-python.nix ({ pkgs, ...} : { name = "openarena"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = [ tomfitzhenry ]; @@ -23,14 +23,19 @@ import ./make-test.nix ({ pkgs, ...} : { testScript = '' - $machine->waitForUnit("openarena.service"); - $machine->waitUntilSucceeds("ss --numeric --udp --listening | grep -q 27960"); + machine.wait_for_unit("openarena.service") + machine.wait_until_succeeds("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'"); + machine.wait_until_succeeds( + "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"); + # Can't use substring match instead of grep because the output is not utf-8 + machine.succeed( + "echo -n -e '\\xff\\xff\\xff\\xffgetchallenge' | socat - UDP4-DATAGRAM:127.0.0.1:27960 | grep -q challengeResponse" + ) ''; })