From d27cf320cf23d45261b64326793e8e41bdba5971 Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:59:10 -0400 Subject: [PATCH] zookeeper: Add simple test --- nixos/release.nix | 2 +- nixos/tests/zookeeper.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/zookeeper.nix diff --git a/nixos/release.nix b/nixos/release.nix index d5f59a524e04..3ecf2ca42ced 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -329,7 +329,7 @@ in rec { tests.wordpress = callTest tests/wordpress.nix {}; tests.xfce = callTest tests/xfce.nix {}; tests.xmonad = callTest tests/xmonad.nix {}; - + tests.zookeeper = callTest tests/zookeeper.nix {}; /* Build a bunch of typical closures so that Hydra can keep track of the evolution of closure sizes. */ diff --git a/nixos/tests/zookeeper.nix b/nixos/tests/zookeeper.nix new file mode 100644 index 000000000000..d247654adade --- /dev/null +++ b/nixos/tests/zookeeper.nix @@ -0,0 +1,28 @@ +import ./make-test.nix ({ pkgs, ...} : { + name = "zookeeper"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + server = { pkgs, config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + }; + + testScript = '' + startAll; + + $server->waitForUnit("zookeeper"); + $server->waitForUnit("network.target"); + $server->waitForOpenPort(2181); + + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar"); + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello"); + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello"); + ''; +})