Skip to content
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
11 changes: 10 additions & 1 deletion pkg/apis/servicecatalog/validation/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ func TestValidateServiceInstance(t *testing.T) {
instance: validServiceInstance(),
valid: true,
},
{
name: "valid planName",
instance: func() *servicecatalog.ServiceInstance {
i := validServiceInstance()
i.Spec.ClusterServicePlanExternalName = "9651.JVHbebe"
return i
}(),
valid: true,
},
{
name: "missing namespace",
instance: func() *servicecatalog.ServiceInstance {
Expand Down Expand Up @@ -154,7 +163,7 @@ func TestValidateServiceInstance(t *testing.T) {
name: "invalid planName",
instance: func() *servicecatalog.ServiceInstance {
i := validServiceInstance()
i.Spec.ClusterServicePlanExternalName = "9651.JVHbebe"
i.Spec.ClusterServicePlanExternalName = "9651_JVHbebe"
return i
}(),
valid: false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/servicecatalog/validation/serviceclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
sc "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog"
)

const serviceClassNameFmt string = `[-a-zA-Z0-9]+`
const serviceClassNameFmt string = `[-.a-zA-Z0-9]+`
const serviceClassNameMaxLength int = 63

var serviceClassNameRegexp = regexp.MustCompile("^" + serviceClassNameFmt + "$")
Expand Down
13 changes: 11 additions & 2 deletions pkg/apis/servicecatalog/validation/serviceclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ func TestValidateClusterServiceClass(t *testing.T) {
}(),
valid: true,
},
{
name: "valid serviceClass - period in externalName",
serviceClass: func() *servicecatalog.ClusterServiceClass {
s := validClusterServiceClass()
s.Spec.ExternalName = "abc.com"
return s
}(),
valid: true,
},
{
name: "invalid serviceClass - has namespace",
serviceClass: func() *servicecatalog.ClusterServiceClass {
Expand Down Expand Up @@ -114,10 +123,10 @@ func TestValidateClusterServiceClass(t *testing.T) {
valid: false,
},
{
name: "invalid serviceClass - period in externalName",
name: "invalid serviceClass - underscore in externalName",
serviceClass: func() *servicecatalog.ClusterServiceClass {
s := validClusterServiceClass()
s.Spec.ExternalName = "abc.com"
s.Spec.ExternalName = "test_serviceclass"
return s
}(),
valid: false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/servicecatalog/validation/serviceplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
sc "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog"
)

const servicePlanNameFmt string = `[-a-zA-Z0-9]+`
const servicePlanNameFmt string = `[-.a-zA-Z0-9]+`
const servicePlanNameMaxLength int = 63

var servicePlanNameRegexp = regexp.MustCompile("^" + servicePlanNameFmt + "$")
Expand Down
9 changes: 9 additions & 0 deletions pkg/apis/servicecatalog/validation/serviceplan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ func TestValidateClusterServicePlan(t *testing.T) {
servicePlan: validClusterServicePlan(),
valid: true,
},
{
name: "valid servicePlan - period in externalName",
servicePlan: func() *servicecatalog.ClusterServicePlan {
s := validClusterServicePlan()
s.Spec.ExternalName = "test.plan"
return s
}(),
valid: true,
},
{
name: "missing name",
servicePlan: func() *servicecatalog.ClusterServicePlan {
Expand Down