Test for httptrigger and functions container/newdeploy (#2861)

* Test for httptrigger and functions
* Fixes with multierror
* review changes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-10-27 15:05:20 +05:30
committed by GitHub
parent 2eb2eba88c
commit 2223081c80
24 changed files with 292 additions and 166 deletions
+6 -7
View File
@@ -129,25 +129,24 @@ func ValidateKubeLabel(field string, labels map[string]string) error {
}
func ValidateKubePort(field string, port int) error {
result := &multierror.Error{}
var err error
e := validation.IsValidPortNum(port)
if len(e) > 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, port, e...))
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, port, e...))
}
return result.ErrorOrNil()
return err
}
func ValidateKubeName(field string, val string) error {
result := &multierror.Error{}
var err error
e := validation.IsDNS1123Label(val)
if len(e) > 0 {
result = multierror.Append(result, MakeValidationErr(ErrorInvalidValue, field, val, e...))
err = errors.Join(err, MakeValidationErr(ErrorInvalidValue, field, val, e...))
}
return result.ErrorOrNil()
return err
}
// validateNS is to match the k8s behaviour. Where it is not mandatory to provide a NS. And so we validate it if user has provided one.