Skip to content

Commit

Permalink
Merge pull request #25073 from redpanda-data/DEVPROD-2618
Browse files Browse the repository at this point in the history
Fixing check azure instances output parsing
  • Loading branch information
rpdevmp authored Feb 11, 2025
2 parents eebad47 + b241b32 commit b063290
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/rptest/redpanda_cloud_tests/config_profile_verify_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,27 @@ def _check_azure_nodes(self):
'--output', f'jsonpath-as-json="{jsonpath}"'
] # yapf: disable

output = subprocess.check_output(cmd)
self.logger.debug(f'nodes: {output}')
nodes = json.loads(output)
try:
nodes = json.loads(nodes)
except json.JSONDecodeError as e:
output = subprocess.check_output(cmd).decode("utf-8").strip()

self.logger.debug(f'Azure nodes raw output: {output}')

# Convert space separated output into a Python list
# Example: ["Standard_D2d_v5", "Standard_D2d_v5", "Standard_D2d_v5"]
nodes = output.split()

# Ensure we have nodes to validate
if not nodes:
self.logger.error(
f"Failed to parse kubectl get nodes response: {nodes}")
"No nodes found with selector 'redpanda-node=true'")
raise ValueError(
f"Failed to parse kubectl get nodes response: {e}")
"No nodes found with selector 'redpanda-node=true'")

# Validate the number of nodes
config_nodes_count = self._configProfile['nodes_count']
actual_nodes_count = len(nodes)
assert actual_nodes_count == config_nodes_count, f"expected nodes_count: {config_nodes_count}, actual: {actual_nodes_count}"

# Validate machine type
config_machine_type = self._configProfile['machine_type']
actual_machine_type = nodes[0]
assert actual_machine_type == config_machine_type, f"expected machineType: {config_machine_type}, actual: {actual_machine_type}"
Expand Down

0 comments on commit b063290

Please sign in to comment.