2020-12-25 13:55:36 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
let
|
|
|
|
|
|
|
|
perlEnv = pkgs.perl.withPackages (p: [p.NetZooKeeper]);
|
|
|
|
|
|
|
|
in {
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "zookeeper";
|
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
2020-12-25 13:55:36 +00:00
|
|
|
maintainers = [ nequissimus ztzg ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
server = { ... }: {
|
|
|
|
services.zookeeper = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 2181 ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
|
|
|
|
server.wait_for_unit("zookeeper")
|
|
|
|
server.wait_for_unit("network.target")
|
|
|
|
server.wait_for_open_port(2181)
|
|
|
|
|
|
|
|
server.wait_until_succeeds(
|
|
|
|
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar"
|
|
|
|
)
|
|
|
|
server.wait_until_succeeds(
|
|
|
|
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello"
|
|
|
|
)
|
|
|
|
server.wait_until_succeeds(
|
|
|
|
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello"
|
|
|
|
)
|
2020-12-25 13:55:36 +00:00
|
|
|
|
|
|
|
server.wait_until_succeeds(
|
|
|
|
"${perlEnv}/bin/perl -E 'use Net::ZooKeeper qw(:acls); $z=Net::ZooKeeper->new(q(localhost:2181)); $z->create(qw(/perl foo acl), ZOO_OPEN_ACL_UNSAFE) || die $z->get_error()'"
|
|
|
|
)
|
|
|
|
server.wait_until_succeeds(
|
|
|
|
"${perlEnv}/bin/perl -E 'use Net::ZooKeeper qw(:acls); $z=Net::ZooKeeper->new(q(localhost:2181)); $z->get(qw(/perl)) eq qw(foo) || die $z->get_error()'"
|
|
|
|
)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
})
|