Skip to content

Commit d960bf1

Browse files
committed
behaviors: enforce behavior id must have suite id as prefix
1 parent 85724cf commit d960bf1

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

test/conformance/behaviors/behaviors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"os"
2424
"path/filepath"
2525
"regexp"
26+
"strings"
2627

2728
"gopkg.in/yaml.v2"
2829
)
@@ -68,6 +69,9 @@ func ValidateSuite(suite *Suite) error {
6869
if _, ok := behaviorsByID[b.ID]; ok {
6970
errs = append(errs, fmt.Errorf("Duplicate behavior ID: %s", b.ID))
7071
}
72+
if !strings.HasPrefix(b.ID, suite.Suite) {
73+
errs = append(errs, fmt.Errorf("Invalid behavior ID: %s, must have suite name as prefix: %s", b.ID, suite.Suite))
74+
}
7175
behaviorsByID[b.ID] = true
7276
}
7377
return utilerrors.NewAggregate(errs)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
suite: service/spec
22
description: Base suite for services
33
behaviors:
4-
- id: service/basic-create/selector
4+
- id: service/spec/selector/present-during-create
55
description: When a Service resource is created with type "ClusterIP", "NodePort", or "LoadBalancer",
66
and a selector is specified, an Endpoints object is generated based with the IPs of pods with
77
label keys and values matching the selector.
8-
- id: service/basic-create/no-selector
8+
- id: service/spec/selector/absent-during-create
99
description: When a Service resource is created and a no selector is specified, no changes are made
1010
to any corresponding Endpoints object.
11-
- id: service/type/ClusterIP/empty
11+
- id: service/spec/type/ClusterIP/empty
1212
description: When the Service type is specified as "ClusterIP" and the clusterIP
1313
field is empty, a cluster-internal IP address for load-balancing to endpoints is
1414
allocated.
15-
- id: service/type/ClusterIP/static
15+
- id: service/spec/type/ClusterIP/static
1616
description: When the Service type is specified as "ClusterIP" and the clusterIP
1717
field is specified as an IP address in the cluster service range, and that IP is
1818
not already assigned to another service, that IP is be allocated as a cluster-internal
1919
IP address for load-balancing to endpoints.
20-
- id: service/type/ClusterIP/None
20+
- id: service/spec/type/ClusterIP/None
2121
description: When the Service type is specified as "ClusterIP" and the clusterIP
2222
field is "None", no virtual IP is allocated and the endpoints are published as a
2323
set of endpoints rather than a stable IP.
24-
- id: service/type/NodePort
24+
- id: service/spec/type/NodePort
2525
description: When the Service type is specified as "NodePort" , a cluster-internal
2626
IP address for load-balancing to endpoints is allocated as for type "ClusterIP".
2727
Additionally, a cluster-wide port is allocated on every node, routing to the clusterIP.
28-
- id: service/type/ExternalName
28+
- id: service/spec/type/ExternalName
2929
description: When the Service type is specified as "ExternalName", the cluster DNS provider
3030
publishes a CNAME pointing from the service to the specified external name.

0 commit comments

Comments
 (0)