Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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'])
Beispiel #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(' '))
Beispiel #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)
Beispiel #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(" "))
Beispiel #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"]
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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'])
Beispiel #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']
Beispiel #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(' '))
Beispiel #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'])
Beispiel #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']
Beispiel #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)