def test_stop_services(self): services.stop_services('/tmp', ['test'], "miniboss", False, 50) assert self.collection.options.network.name == 'miniboss' assert self.collection.options.timeout == 50 assert self.collection.options.run_dir == '/tmp' assert not self.collection.options.remove assert self.collection.excluded == ['test']
def test_error_without_group_name(self): types.group_name = None with pytest.raises(exceptions.MinibossException): services.start_services('/tmp', [], "miniboss", 50) with pytest.raises(exceptions.MinibossException): services.stop_services('/tmp', ['test'], "miniboss", False, 50) with pytest.raises(exceptions.MinibossException): services.reload_service('/tmp', 'the-service', "miniboss", False, 50)
def test_stop_services_remove_context(self): directory = tempfile.mkdtemp() path = pathlib.Path(directory) / ".miniboss-context" with open(path, "w") as context_file: context_file.write( json.dumps({ "key_one": "value_one", "key_two": "value_two" })) services.stop_services(directory, [], "miniboss", False, 50) assert path.exists() services.stop_services(directory, [], "miniboss", True, 50) assert not path.exists()
def test_stop_services_network_name_none(self): services.stop_services('/tmp', ['test'], None, False, 50) assert self.collection.options.network.name == 'miniboss-test'
def stop(exclude, network_name, remove, timeout): exclude = exclude.split(",") if exclude else [] services.stop_services(get_main_directory(), exclude, network_name, remove, timeout)