1 # Test a minimal hbase cluster
3 import ../make-test-python.nix ({ hadoop ? pkgs.hadoop, hbase ? pkgs.hbase, ... }:
10 "fs.defaultFS" = "hdfs://namenode:8020";
16 zookeeperQuorum = "zookeeper";
18 zookeeper = { ... }: {
19 services.zookeeper.enable = true;
20 networking.firewall.allowedTCPPorts = [ 2181 ];
25 namenode = defOpts // { formatOnInit = true; };
31 virtualisation.diskSize = 8192;
33 hdfs.datanode = defOpts;
42 inherit zookeeperQuorum;
43 master = defOpts // { initHDFS = true; };
47 regionserver = { ... }:{
51 inherit zookeeperQuorum;
52 regionServer = defOpts;
60 inherit zookeeperQuorum;
69 inherit zookeeperQuorum;
79 # wait for HDFS cluster
80 namenode.wait_for_unit("hdfs-namenode")
81 namenode.wait_for_unit("network.target")
82 namenode.wait_for_open_port(8020)
83 namenode.wait_for_open_port(9870)
84 datanode.wait_for_unit("hdfs-datanode")
85 datanode.wait_for_unit("network.target")
86 datanode.wait_for_open_port(9864)
87 datanode.wait_for_open_port(9866)
88 datanode.wait_for_open_port(9867)
91 zookeeper.wait_for_unit("zookeeper")
92 zookeeper.wait_for_open_port(2181)
94 # wait for HBase to start up
95 master.wait_for_unit("hbase-master")
96 regionserver.wait_for_unit("hbase-regionserver")
98 assert "1 active master, 0 backup masters, 1 servers" in master.succeed("echo status | HADOOP_USER_NAME=hbase hbase shell -n")
99 regionserver.wait_until_succeeds("echo \"create 't1','f1'\" | HADOOP_USER_NAME=hbase hbase shell -n")
100 assert "NAME => 'f1'" in regionserver.succeed("echo \"describe 't1'\" | HADOOP_USER_NAME=hbase hbase shell -n")
102 rest.wait_for_open_port(8080)
103 assert "${hbase.version}" in regionserver.succeed("curl http://rest:8080/version/cluster")
105 thrift.wait_for_open_port(9090)
108 meta.maintainers = with maintainers; [ illustris ];