diff --git a/legion/tests/test_edi.py b/legion/tests/test_edi.py index b9a72f64b..7a6acb04d 100644 --- a/legion/tests/test_edi.py +++ b/legion/tests/test_edi.py @@ -264,7 +264,6 @@ def test_edi_undeploy_model_by_id(self): self.assertEqual(deployments[0].image, '127.0.0.1/legion/test-bare-model-api-model-1:0.9.0-20181106123540.560.3b9739a') - def test_negative_edi_undeploy_by_invalid_model_id(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'one_model'), \ @@ -275,14 +274,14 @@ def test_negative_edi_undeploy_by_invalid_model_id(self): self.assertEqual(str(e), "Got error from server: 'No one model can be found'") - def test_edi_scale_up(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'one_model'), \ m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', 'one_model'), \ m_func('kubernetes.client.ExtensionsV1beta1Api.patch_namespaced_deployment', 'one_model_scaled_to_2'), \ - m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', 'one_model_scaled_to_2'), \ + m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', + 'one_model_scaled_to_2'), \ mock.patch('legion.k8s.utils.build_client', return_value=None): deployments = edi.edi_client.scale('demo-abc-model', 2) self.assertIsInstance(deployments, list) @@ -297,11 +296,11 @@ def test_edi_scale_up(self): self.assertEqual(deployments[0].image, '127.0.0.1/legion/test-bare-model-api-model-1:0.9.0-20181106123540.560.3b9739a') - def test_edi_scale_down(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'one_model'), \ - m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', 'one_model_scaled_to_2'), \ + m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', + 'one_model_scaled_to_2'), \ m_func('kubernetes.client.ExtensionsV1beta1Api.patch_namespaced_deployment', 'one_model_scaled_to_1'), \ m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', 'one_model'), \ @@ -319,12 +318,12 @@ def test_edi_scale_down(self): self.assertEqual(deployments[0].image, '127.0.0.1/legion/test-bare-model-api-model-1:0.9.0-20181106123540.560.3b9739a') - def test_negative_edi_scale_to_0(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'one_model'), \ m_func('kubernetes.client.ExtensionsV1beta1Api.list_namespaced_deployment', 'one_model'), \ - m_func('kubernetes.client.ExtensionsV1beta1Api.patch_namespaced_deployment', 'one_model_scaled_to_2'), \ + m_func('kubernetes.client.ExtensionsV1beta1Api.patch_namespaced_deployment', + 'one_model_scaled_to_2'), \ mock.patch('legion.k8s.utils.build_client', return_value=None): try: edi.edi_client.scale('demo-abc-model', 0) @@ -332,7 +331,6 @@ def test_negative_edi_scale_to_0(self): self.assertEqual(str(e), "Got error from server: 'Invalid scale parameter: should be greater then 0'") - def test_negative_edi_invalid_model_id(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'one_model'), \ @@ -347,7 +345,6 @@ def test_negative_edi_invalid_model_id(self): self.assertEqual(str(e), "Got error from server: 'No one model can be found'") - def test_edi_inspect_all_models_by_version(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -377,7 +374,6 @@ def test_edi_inspect_all_models_by_version(self): self.assertEqual(deployments[1].image, '127.0.0.1/legion/test-bare-model-api-model-2:0.9.0-20181106123540.560.3b9739a') - def test_edi_inspect_all_models_by_id(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -407,7 +403,6 @@ def test_edi_inspect_all_models_by_id(self): self.assertEqual(deployments[1].image, '127.0.0.1/legion/test-bare-model-api-model-2:0.9.0-20181106123540.560.3b9739a') - def test_negative_edi_scale_without_version(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -421,7 +416,6 @@ def test_negative_edi_scale_without_version(self): self.assertEqual(str(e), "Got error from server: 'Please specify version of model'") - def test_negative_edi_undeploy_without_version(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -436,7 +430,6 @@ def test_negative_edi_undeploy_without_version(self): self.assertEqual(str(e), "Got error from server: 'Please specify version of model'") - def test_edi_undeploy_all_models_by_version(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -469,7 +462,6 @@ def test_edi_undeploy_all_models_by_version(self): self.assertEqual(deployments[1].image, '127.0.0.1/legion/test-bare-model-api-model-2:0.9.0-20181106123540.560.3b9739a') - def test_edi_scale_all_models_by_version(self): with EDITestServer() as edi: with m_func('kubernetes.client.CoreV1Api.list_namespaced_service', 'two_models_1_id_and_2_versions'), \ @@ -503,7 +495,6 @@ def test_edi_scale_all_models_by_version(self): self.assertEqual(deployments[1].image, '127.0.0.1/legion/test-bare-model-api-model-2:0.9.0-20181106123540.560.3b9739a') - # TODO uncomment after https://github.com/legion-platform/legion/pull/553 will be merged # def test_edi_scale_all_models_by_id(self): # with mock.patch('legion.k8s.enclave.Enclave.graphite_service', return_value=None):