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