Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pkg/apis/servicecatalog/validation/serviceclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ func validateServicePlan(plan sc.ServicePlan, fldPath *field.Path) field.ErrorLi
allErrs = append(allErrs, field.Required(field.NewPath("description"), "description is required"))
}

for _, msg := range validateExternalID(plan.ExternalID) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("externalID"), plan.ExternalID, msg))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the presence check is above on line 110.

}

return allErrs
}

Expand Down
19 changes: 5 additions & 14 deletions pkg/apis/servicecatalog/validation/serviceclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ func TestValidateServiceClass(t *testing.T) {
}(),
valid: false,
},
{
name: "invalid serviceClass - invalid guid",
serviceClass: func() *servicecatalog.ServiceClass {
s := validServiceClass()
s.ExternalID = "1234-4354a\\%-49b"
return s
}(),
valid: false,
},
{
name: "invalid serviceClass - missing description",
serviceClass: func() *servicecatalog.ServiceClass {
Expand All @@ -118,19 +109,19 @@ func TestValidateServiceClass(t *testing.T) {
valid: false,
},
{
name: "invalid serviceClass - invalid plan guid",
name: "valid serviceClass - special charaters in plan id",
serviceClass: func() *servicecatalog.ServiceClass {
s := validServiceClass()
s.Plans[0].ExternalID = "40d-0983-1b89-★"
s.Plans[0].ExternalID = "40D-0983-1b89.plan!%'<>~¥"
return s
}(),
valid: false,
valid: true,
},
{
name: "invalid serviceClass - missing plan guid",
name: "invalid serviceClass - missing plan id",
serviceClass: func() *servicecatalog.ServiceClass {
s := validServiceClass()
s.Plans[0].ExternalID = "40d-0983-1b89-★"
s.Plans[0].ExternalID = ""
return s
}(),
valid: false,
Expand Down