diff options
author | Daniel Schaefer <git@danielschaefer.me> | 2019-04-23 05:05:39 +0200 |
---|---|---|
committer | Daniel Schaefer <git@danielschaefer.me> | 2019-06-13 04:36:41 +0200 |
commit | 7d646f260566361606b256b608fdf57e9d8a4564 (patch) | |
tree | e3758ac7a444c725ae81e8e7f209d7fa0fc8e817 /nixos | |
parent | 3162f45388638d04faac82a5d8c2dcf3076a84bc (diff) |
nixos/cassandra: Test jmxRoles
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/cassandra.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/nixos/tests/cassandra.nix b/nixos/tests/cassandra.nix index a14cec5ab19a..c67239931e10 100644 --- a/nixos/tests/cassandra.nix +++ b/nixos/tests/cassandra.nix @@ -4,6 +4,11 @@ let testPackage = pkgs.cassandra; clusterName = "NixOS Automated-Test Cluster"; + jmxRoles = [{ username = "me"; password = "password"; }]; + jmxAuthArgs = "-u ${(builtins.elemAt jmxRoles 0).username} -pw ${(builtins.elemAt jmxRoles 0).password}"; + clusterName = "NixOS Test Cluster"; + + # Would usually be assigned to 512M numMaxHeapSize = "400"; getHeapLimitCommand = '' nodetool info | grep "^Heap Memory" | awk \'{print $NF}\' @@ -40,7 +45,7 @@ in nodes = { cass0 = nodeCfg "192.168.1.1" {}; - cass1 = nodeCfg "192.168.1.2" {}; + cass1 = nodeCfg "192.168.1.2" { remoteJmx = true; inherit jmxRoles; }; cass2 = nodeCfg "192.168.1.3" { jvmOpts = [ "-Dcassandra.replace_address=cass1" ]; }; }; @@ -74,15 +79,25 @@ in # Check cluster interaction subtest "Bring up cluster", sub { $cass1->waitForUnit("cassandra.service"); - $cass1->waitUntilSucceeds("nodetool status | egrep -c '^UN' | grep 2"); + $cass1->waitUntilSucceeds("nodetool ${jmxAuthArgs} status | egrep -c '^UN' | grep 2"); $cass0->succeed("nodetool status --resolve-ip | egrep '^UN[[:space:]]+cass1'"); }; + subtest "Remote authenticated jmx", sub { + # Doesn't work if not enabled + $cass0->waitUntilSucceeds("nc -z localhost 7199"); + $cass1->fail("nc -z 192.168.1.1 7199"); + $cass1->fail("nodetool -h 192.168.1.1 status"); + + # Works if enabled + $cass1->waitUntilSucceeds("nc -z localhost 7199"); + $cass0->succeed("nodetool -h 192.168.1.2 ${jmxAuthArgs} status"); + }; subtest "Break and fix node", sub { $cass1->block; $cass0->waitUntilSucceeds("nodetool status --resolve-ip | egrep -c '^DN[[:space:]]+cass1'"); $cass0->succeed("nodetool status | egrep -c '^UN' | grep 1"); $cass1->unblock; - $cass1->waitUntilSucceeds("nodetool status | egrep -c '^UN' | grep 2"); + $cass1->waitUntilSucceeds("nodetool ${jmxAuthArgs} status | egrep -c '^UN' | grep 2"); $cass0->succeed("nodetool status | egrep -c '^UN' | grep 2"); }; subtest "Replace crashed node", sub { |