Skip to content

Commit d6fb9d5

Browse files
committed
Test valkey-cli using cluster mode
Signed-off-by: James Duong <[email protected]>
1 parent 37c9eef commit d6fb9d5

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

utils/remote_cluster_manager.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,31 @@ def test_certificates_on_server(self, endpoints: List[str]) -> None:
959959
else:
960960
logging.warning(f"FAILED - Server-side valkey-cli TLS connection failed: {stderr}")
961961

962+
# Test cluster mode connection with valkey-cli
963+
cluster_test_cmd = f"cd {self.remote_repo_path}/utils && export PATH={self.engine_path}/src:$PATH && echo 'CLUSTER INFO' | valkey-cli -c -h {host} -p {port} --tls --cert tls_crts/server.crt --key tls_crts/server.key --cacert tls_crts/ca.crt"
964+
returncode, stdout, stderr = self._execute_remote_command(cluster_test_cmd, timeout=10)
965+
966+
if returncode == 0 and 'cluster_state:ok' in stdout:
967+
logging.info("SUCCESS - Server-side valkey-cli CLUSTER mode TLS connection works")
968+
else:
969+
logging.warning(f"FAILED - Server-side valkey-cli CLUSTER mode TLS connection failed: {stderr}")
970+
971+
# Test cluster discovery with valkey-cli
972+
cluster_nodes_cmd = f"cd {self.remote_repo_path}/utils && export PATH={self.engine_path}/src:$PATH && echo 'CLUSTER NODES' | valkey-cli -c -h {host} -p {port} --tls --cert tls_crts/server.crt --key tls_crts/server.key --cacert tls_crts/ca.crt"
973+
returncode, stdout, stderr = self._execute_remote_command(cluster_nodes_cmd, timeout=10)
974+
975+
if returncode == 0:
976+
logging.info("SUCCESS - Server-side valkey-cli cluster discovery works")
977+
logging.info("Cluster nodes discovered:")
978+
for line in stdout.split('\n')[:6]: # First 6 nodes
979+
if line.strip() and '172.31.34.123' in line:
980+
parts = line.split()
981+
if len(parts) >= 2:
982+
node_addr = parts[1].split('@')[0]
983+
logging.info(f" Node: {node_addr}")
984+
else:
985+
logging.warning(f"FAILED - Server-side valkey-cli cluster discovery failed: {stderr}")
986+
962987
# Print certificate details on server
963988
cert_info_cmd = f"cd {self.remote_repo_path}/utils && openssl x509 -in tls_crts/ca.crt -text -noout | head -20"
964989
returncode, stdout, stderr = self._execute_remote_command(cert_info_cmd, timeout=5)

0 commit comments

Comments
 (0)