Skip to content

Commit

Permalink
Fix unit tests 2
Browse files Browse the repository at this point in the history
  • Loading branch information
whynick1 committed Dec 10, 2019
1 parent 14b6f95 commit 0076773
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions ducktape/cluster/node_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,12 @@ def satisfy(avail_node, req_node):
"""
Return true if available node satisfies the minimum requirement of requested node.
"""
if avail_node.machine_type.cpu_core < req_node.machine_type.cpu_core or \
avail_node.machine_type.mem_size_gb < req_node.machine_type.mem_size_gb or \
avail_node.machine_type.disk_size_gb < req_node.machine_type.disk_size_gb:
if req_node.machine_type is None:
return True
elif avail_node.machine_type is None or \
avail_node.machine_type.cpu_core < req_node.machine_type.cpu_core or \
avail_node.machine_type.mem_size_gb < req_node.machine_type.mem_size_gb or \
avail_node.machine_type.disk_size_gb < req_node.machine_type.disk_size_gb:
return False
for d_name, d_size in req_node.machine_type.additional_disks.items():
if avail_node.machine_type.additional_disks.get(d_name, 0) < d_size:
Expand All @@ -205,7 +208,8 @@ def sort(nodes, reverse=False):
type_based_nodes.append(node)

sorted_nodes.extend(sorted(type_based_nodes, key=attrgetter('machine_type.cpu_core', 'machine_type.mem_size_gb',
'machine_type.disk_size_gb', 'machine_type.additional_disks')))
'machine_type.disk_size_gb',
'machine_type.additional_disks')))
return list(reversed(sorted_nodes)) if reverse else sorted_nodes

def clone(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/cluster/check_remoteaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def check_remote_account_equality(self):
kwargs = {
"ssh_config": ssh_config,
"externally_routable_ip": "345",
"logger": logging.getLogger(__name__)
"logger": logging.getLogger(__name__),
"is_type_based": False
}
r1 = RemoteAccount(**kwargs)
r2 = RemoteAccount(**kwargs)
Expand Down

0 comments on commit 0076773

Please sign in to comment.