コード例 #1
0
    def check_service_constructor(self):
        """Check that BackgroundThreadService constructor corresponds to the base class's one."""
        exp_spec = ClusterSpec.simple_linux(10)
        service = BackgroundThreadService(self.context, cluster_spec=exp_spec)
        assert service.cluster_spec == exp_spec

        service = BackgroundThreadService(self.context, num_nodes=20)
        assert service.cluster_spec.size() == 20

        with pytest.raises(RuntimeError):
            BackgroundThreadService(self.context,
                                    num_nodes=20,
                                    cluster_spec=exp_spec)