Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
whynick1 committed Aug 31, 2019
1 parent bac997c commit 8db4931
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion tests/cluster/check_cluster_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,23 @@ def check_to_string(self):
empty = ClusterSpec.empty()
assert "[]" == str(empty)
simple_linux_5 = ClusterSpec.simple_linux(5)
assert '[{"num_nodes": 5, "os": "linux"}]' == str(simple_linux_5)
assert '[{"additional_disks(GB)": {}, "cpu": 1, "disk(GB)": 10.0, "mem(GB)": 1.0, "num_nodes": 5,' \
'"os": "linux"}]' == str(simple_linux_5)

def check_from_dict(self):
empty = ClusterSpec.empty()
assert "[]" == str(empty)
node_specs_dict = {'cpu': 2, 'mem': '2GB', 'disk': '30GB', 'num_nodes': 2}
custom_linux_1 = ClusterSpec.from_dict(node_specs_dict)
assert '[{"additional_disks(GB)": {}, "cpu": 2, "disk(GB)": 30, "mem(GB)": 2, "num_nodes": 2, "os": "linux"}]' \
== str(custom_linux_1)

def check_from_list(self):
empty = ClusterSpec.empty()
assert "[]" == str(empty)
node_specs_dict_list = [{'cpu': 2, 'mem': '2GB', 'disk': '20GB', 'num_nodes': 2},
{'cpu': 4, 'mem': '4GB', 'disk': '40GB', 'num_nodes': 4}]
custom_linux_2 = ClusterSpec.from_list(node_specs_dict_list)
assert '[{"additional_disks(GB)": {}, "cpu": 2, "disk(GB)": 30, "mem(GB)": 2, "num_nodes": 2, "os": "linux"},' \
' {"additional_disks(GB)": {}, "cpu": 4, "disk(GB)":40, "mem(GB)": 4, "num_nodes": 4, "os": "linux"}]' \
== str(custom_linux_2)
2 changes: 1 addition & 1 deletion tests/cluster/check_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def check_cluster_size(self):
n = 10
cluster = JsonCluster(
{"nodes": [
{"ssh_config": {"hostname": "localhost%d" % x}} for x in range(n)]})
{"ssh_config": {"host": "localhost%d" % x}} for x in range(n)]})

assert len(cluster) == n

Expand Down

0 comments on commit 8db4931

Please sign in to comment.