2020-11-25 09:33:26 +00:00
|
|
|
import ./make-test-python.nix (
|
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2020-11-25 09:33:26 +00:00
|
|
|
perlEnv = pkgs.perl.withPackages (p: [ p.NetZooKeeper ]);
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2020-11-25 09:33:26 +00:00
|
|
|
in
|
|
|
|
{
|
2017-11-02 17:59:10 +00:00
|
|
|
name = "zookeeper";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-11-25 09:33:26 +00:00
|
|
|
maintainers = [
|
|
|
|
nequissimus
|
|
|
|
ztzg
|
|
|
|
];
|
2017-11-02 17:59:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
2018-07-20 20:56:59 +00:00
|
|
|
server =
|
|
|
|
{ ... }:
|
|
|
|
{
|
2017-11-02 17:59:10 +00:00
|
|
|
services.zookeeper = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 2181 ];
|
2024-12-10 19:26:33 +00:00
|
|
|
};
|
2017-11-02 17:59:10 +00:00
|
|
|
};
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2017-11-02 17:59:10 +00:00
|
|
|
testScript = ''
|
2019-11-06 06:54:37 +00:00
|
|
|
start_all()
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-11-06 06:54:37 +00:00
|
|
|
server.wait_for_unit("zookeeper")
|
|
|
|
server.wait_for_unit("network.target")
|
|
|
|
server.wait_for_open_port(2181)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2019-11-06 06:54:37 +00:00
|
|
|
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"
|
|
|
|
)
|
2024-12-10 19:26:33 +00:00
|
|
|
|
2020-11-25 09:33:26 +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()'"
|
|
|
|
)
|
2017-11-02 17:59:10 +00:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|