diff --git a/tests/cluster/check_cluster_spec.py b/tests/cluster/check_cluster_spec.py index b50c9edbe..6b83f8a13 100644 --- a/tests/cluster/check_cluster_spec.py +++ b/tests/cluster/check_cluster_spec.py @@ -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) diff --git a/tests/cluster/check_json.py b/tests/cluster/check_json.py index 2205b61eb..8b28d871c 100644 --- a/tests/cluster/check_json.py +++ b/tests/cluster/check_json.py @@ -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