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