git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/cassandra: Test remote auth only on v3.11+

Below that it works but only when supplying a custom password file with restricted permissions (i.e. outside the nix-store). We can't do that using an absolute path in the tests.

commit8e5ba87b36c8640ada623811ec5f22af6fe60d44 authorDaniel Schaefer <git@danielschaefer.me> dateFri 26 Apr 2019, 01:13 (8 years ago) parent79f7f89
1 file changed+6−3
nixos/tests/cassandra.nix+6−3
nixos/tests/cassandra.nix+6−3
@@ -1,12 +1,13 @@
1−import ./make-test.nix ({ pkgs, ...}:
1+import ./make-test.nix ({ pkgs, lib, ... }:
22let
33 # Change this to test a different version of Cassandra:
44 testPackage = pkgs.cassandra;
55 clusterName = "NixOS Automated-Test Cluster";
66
7+ testRemoteAuth = lib.versionAtLeast testPackage.version "3.11";
78 jmxRoles = [{ username = "me"; password = "password"; }];
9+ jmxRolesFile = ./cassandra-jmx-roles;
810 jmxAuthArgs = "-u ${(builtins.elemAt jmxRoles 0).username} -pw ${(builtins.elemAt jmxRoles 0).password}";
9− clusterName = "NixOS Test Cluster";
1011
1112 # Would usually be assigned to 512M
1213 numMaxHeapSize = "400";
@@ -45,7 +46,7 @@ in
4546
4647 nodes = {
4748 cass0 = nodeCfg "192.168.1.1" {};
48− cass1 = nodeCfg "192.168.1.2" { remoteJmx = true; inherit jmxRoles; };
49+ cass1 = nodeCfg "192.168.1.2" (lib.optionalAttrs testRemoteAuth { inherit jmxRoles; remoteJmx = true; });
4950 cass2 = nodeCfg "192.168.1.3" { jvmOpts = [ "-Dcassandra.replace_address=cass1" ]; };
5051 };
5152
@@ -82,6 +83,7 @@ in
8283 $cass1->waitUntilSucceeds("nodetool ${jmxAuthArgs} status | egrep -c '^UN' | grep 2");
8384 $cass0->succeed("nodetool status --resolve-ip | egrep '^UN[[:space:]]+cass1'");
8485 };
86+ '' + lib.optionalString testRemoteAuth ''
8587 subtest "Remote authenticated jmx", sub {
8688 # Doesn't work if not enabled
8789 $cass0->waitUntilSucceeds("nc -z localhost 7199");
@@ -92,6 +94,7 @@ in
9294 $cass1->waitUntilSucceeds("nc -z localhost 7199");
9395 $cass0->succeed("nodetool -h 192.168.1.2 ${jmxAuthArgs} status");
9496 };
97+ '' + ''
9598 subtest "Break and fix node", sub {
9699 $cass1->block;
97100 $cass0->waitUntilSucceeds("nodetool status --resolve-ip | egrep -c '^DN[[:space:]]+cass1'");