diff --git a/tests/cluster/check_cluster.py b/tests/cluster/check_cluster.py index 2c9ad3ebf..7f5537591 100644 --- a/tests/cluster/check_cluster.py +++ b/tests/cluster/check_cluster.py @@ -18,18 +18,18 @@ from ducktape.cluster.cluster_spec import NodeSpec, ClusterSpec, LINUX, WINDOWS from tests.ducktape_mock import FakeCluster -FakeRemoteAccount = collections.namedtuple('FakeRemoteAccount', ['operating_system']) +FakeRemoteAccount = collections.namedtuple('FakeRemoteAccount', ['operating_system', 'host_type']) class CheckCluster(object): def setup_method(self, _): self.cluster = FakeCluster(0) - self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=LINUX))) - self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=LINUX))) - self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS))) - self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS))) - self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS))) + self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=LINUX, host_type=LINUX))) + self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=LINUX, host_type=LINUX))) + self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS, host_type=WINDOWS))) + self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS, host_type=WINDOWS))) + self.cluster._available_nodes.add_node(ClusterNode(FakeRemoteAccount(operating_system=WINDOWS, host_type=WINDOWS))) def spec(self, linux_nodes, windows_nodes): nodes = [] diff --git a/tests/cluster/check_cluster_spec.py b/tests/cluster/check_cluster_spec.py index b50c9edbe..142906dae 100644 --- a/tests/cluster/check_cluster_spec.py +++ b/tests/cluster/check_cluster_spec.py @@ -25,4 +25,11 @@ 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 '[{"num_nodes": 5, "type": "linux"}]' == str(simple_linux_5) + + def check_from_dict(self): + empty = ClusterSpec.empty() + assert "[]" == str(empty) + node_specs_dict = {"linux": 2, "windows": 3} + linux_2_windows_3 = ClusterSpec.from_dict(node_specs_dict) + assert '[{"num_nodes": 2, "type": "linux"}, {"num_nodes": 3, "type": "windows"}]' == str(linux_2_windows_3) diff --git a/tests/cluster/check_finite_subcluster.py b/tests/cluster/check_finite_subcluster.py index 0ef4d6182..66c5dda7a 100644 --- a/tests/cluster/check_finite_subcluster.py +++ b/tests/cluster/check_finite_subcluster.py @@ -25,6 +25,9 @@ class MockFiniteSubclusterNode: def operating_system(self): return LINUX + @property + def host_type(self): + return LINUX class CheckFiniteSubcluster(object): single_node_cluster_json = {"nodes": [{"hostname": "localhost"}]} diff --git a/tests/ducktape_mock.py b/tests/ducktape_mock.py index 3477b4d56..d74b058bc 100644 --- a/tests/ducktape_mock.py +++ b/tests/ducktape_mock.py @@ -35,6 +35,9 @@ class FakeClusterNode(object): def operating_system(self): return LINUX + @property + def host_type(self): + return LINUX class FakeCluster(Cluster): """A cluster class with counters, but no actual node objects"""