def test_start_services(self): services.start_services('/tmp', [], "miniboss", 50) options = self.collection.options assert options.network.name == 'miniboss' assert options.network.id == '' assert options.timeout == 50 assert options.remove == False assert options.run_dir == '/tmp' assert options.build == []
def test_start_services_save_context(self): directory = tempfile.mkdtemp() Context['key_one'] = 'a_value' Context['key_two'] = 'other_value' services.start_services(directory, [], "miniboss", 50) with open(os.path.join(directory, ".miniboss-context"), "r") as context_file: context_data = json.load(context_file) assert context_data == {'key_one': 'a_value', 'key_two': 'other_value'}
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_load_context_on_new(self): directory = tempfile.mkdtemp() with open(os.path.join(directory, ".miniboss-context"), "w") as context_file: context_file.write( json.dumps({ "key_one": "value_one", "key_two": "value_two" })) services.start_services(directory, [], "miniboss", 50) assert Context['key_one'] == 'value_one' assert Context['key_two'] == 'value_two'
def test_services_network_name_none(self): services.start_services('/tmp', [], None, 50) options = self.collection.options assert options.network.name == 'miniboss-test'
def test_start_services_exclude(self): services.start_services("/tmp", ['blah'], "miniboss", 50) assert self.collection.excluded == ['blah']
def start(exclude, network_name, timeout): exclude = exclude.split(",") if exclude else [] services.start_services(get_main_directory(), exclude, network_name, timeout)