Repository: odahu/odahu-flow (language: python)

Issue:
for 400 status code model deployment  missed `Validation of model deployment is failed:` error part
**description**
for all other types of entities, the error for 400 status code contains: `Validation of <entity kind> is failed:`, but model deployment does not.

**specification**
[deployment_no_required_params.txt](https://github.com/odahu/odahu-flow/files/5607696/deployment_no_required_params.txt)

**to reproduce**
1. run `odahuflowctl dep create -f deployment_no_required_params.txt`

**Expected behavior**
error should contain `Validation of model deployment is failed:`

**Actual behavior**
error doesn't contain `Validation of model deployment is failed:`

**Screenshots**
![image](https://user-images.githubusercontent.com/49116723/100446417-70875d80-30b7-11eb-860f-961279923535.png)
![image](https://user-images.githubusercontent.com/49116723/100446550-adebeb00-30b7-11eb-9bee-384cc57cbdb7.png)


Discussion / hints:

Fix patch:
diff --git a/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_validation.go b/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_validation.go
index 63782a51c..05ea8d08b 100644
--- a/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_validation.go
+++ b/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_validation.go
@@ -29,6 +29,7 @@ import (
 )
 
 const (
+	ValidationMdErrorMessage             = "Validation of model deployment is failed"
 	EmptyImageErrorMessage             = "the image parameter is empty"
 	NegativeMinReplicasErrorMessage    = "minimum number of replicas parameter must not be less than 0"
 	NegativeMaxReplicasErrorMessage    = "maximum number of replicas parameter must not be less than 1"
@@ -145,6 +146,10 @@ func (mdv *ModelDeploymentValidator) ValidatesMDAndSetDefaults(md *deployment.Mo
 
 	err = multierr.Append(err, validation.ValidateResources(md.Spec.Resources, config.NvidiaResourceName))
 
+	if err != nil {
+		return fmt.Errorf("%s: %s", ValidationMdErrorMessage, err.Error())
+	}
+
 	return err
 }
 


Test patch:
diff --git a/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_test.go b/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_test.go
index f463a1612..943d0bb63 100644
--- a/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_test.go
+++ b/packages/operator/pkg/apiserver/routes/v1/deployment/model_deployment_test.go
@@ -388,7 +388,7 @@ func (s *ModelDeploymentRouteSuite) TestCreateMDValidation() {
 	s.g.Expect(err).NotTo(HaveOccurred())
 
 	s.g.Expect(w.Code).Should(Equal(http.StatusBadRequest))
-	s.g.Expect(result.Message).To(Equal(dep_route.EmptyImageErrorMessage))
+	s.g.Expect(result.Message).To(ContainSubstring(dep_route.EmptyImageErrorMessage))
 }
 
 func (s *ModelDeploymentRouteSuite) TestCreateDuplicateMD() {
@@ -470,7 +470,7 @@ func (s *ModelDeploymentRouteSuite) TestUpdateMDValidation() {
 	s.g.Expect(err).NotTo(HaveOccurred())
 
 	s.g.Expect(w.Code).Should(Equal(http.StatusBadRequest))
-	s.g.Expect(result.Message).To(Equal(dep_route.EmptyImageErrorMessage))
+	s.g.Expect(result.Message).To(ContainSubstring(dep_route.EmptyImageErrorMessage))
 }
 
 func (s *ModelDeploymentRouteSuite) TestUpdateMDNotFound() {