Exemplo n.º 1
0
 def _container_exists_in_set(self, service_name, include_exited):
     container = get_container_for_app_or_service(service_name, include_exited=include_exited)
     return bool(container)
Exemplo n.º 2
0
 def test_get_container_for_app_or_service_none_found(
         self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     result = get_container_for_app_or_service('app-c')
     self.assertIsNone(result)
Exemplo n.º 3
0
 def test_get_container_for_app_or_service_none_found_with_raise(
         self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     with self.assertRaises(RuntimeError):
         get_container_for_app_or_service('app-c', raise_if_not_found=True)
Exemplo n.º 4
0
 def test_get_container_for_app_or_service_none_found_with_raise(self):
     with self.assertRaises(RuntimeError):
         get_container_for_app_or_service(self.fake_docker_client,
                                           'app-c',
                                           raise_if_not_found=True)
Exemplo n.º 5
0
 def test_get_container_for_app_or_service(self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     result = get_container_for_app_or_service('app-a')
     self.assertIn('/dusty_app-a_1', result['Names'])
Exemplo n.º 6
0
 def exec_in_container(self, service_name, command):
     client = get_docker_client()
     container = get_container_for_app_or_service(client, service_name, raise_if_not_found=True)
     return exec_in_container(client, container, *command.split(' '))
Exemplo n.º 7
0
 def test_get_container_for_app_or_service_none_found(self):
     result = get_container_for_app_or_service(self.fake_docker_client, 'app-c')
     self.assertIsNone(result)
Exemplo n.º 8
0
 def exec_in_container(self, service_name, command):
     container = get_container_for_app_or_service(service_name, raise_if_not_found=True)
     return exec_in_container(container, *command.split(" "))
Exemplo n.º 9
0
 def container_id(self, service_name):
     return get_container_for_app_or_service(service_name, include_exited=True, raise_if_not_found=True)["Id"]
Exemplo n.º 10
0
 def test_get_container_for_app_or_service_none_found_with_raise(self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     with self.assertRaises(RuntimeError):
         get_container_for_app_or_service('app-c', raise_if_not_found=True)
Exemplo n.º 11
0
 def _container_exists_in_set(self, service_name, include_exited):
     container = get_container_for_app_or_service(service_name, include_exited=include_exited)
     return bool(container)
Exemplo n.º 12
0
 def test_get_container_for_app_or_service_none_found(self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     result = get_container_for_app_or_service('app-c')
     self.assertIsNone(result)
Exemplo n.º 13
0
 def test_get_container_for_app_or_service(self, patch_docker_client):
     patch_docker_client.return_value = self.fake_docker_client
     result = get_container_for_app_or_service('app-a')
     self.assertIn('/dusty_app-a_1', result['Names'])
Exemplo n.º 14
0
 def container_id(self, service_name):
     client = get_docker_client()
     return get_container_for_app_or_service(client, service_name, include_exited=True, raise_if_not_found=True)['Id']
Exemplo n.º 15
0
 def exec_in_container(self, service_name, command):
     container = get_container_for_app_or_service(service_name, raise_if_not_found=True)
     return exec_in_container(container, *command.split(' '))
Exemplo n.º 16
0
 def test_get_container_for_app_or_service(self):
     result = get_container_for_app_or_service(self.fake_docker_client, 'app-a')
     self.assertIn('/dusty_app-a_1', result['Names'])
Exemplo n.º 17
0
 def container_id(self, service_name):
     return get_container_for_app_or_service(service_name, include_exited=True, raise_if_not_found=True)['Id']
Exemplo n.º 18
0
 def _container_exists_in_set(self, service_name, include_exited):
     client = get_docker_client()
     container = get_container_for_app_or_service(client, service_name, include_exited=include_exited)
     return bool(container)