From d960bf1903b887c89bd324c0cceb4b3b915ad970 Mon Sep 17 00:00:00 2001 From: Aaron Crickenberger Date: Wed, 3 Jun 2020 11:03:52 -0700 Subject: [PATCH] behaviors: enforce behavior id must have suite id as prefix --- test/conformance/behaviors/behaviors.go | 4 ++++ .../behaviors/sig-network/service-spec.yaml | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/test/conformance/behaviors/behaviors.go b/test/conformance/behaviors/behaviors.go index 95eba28d1b4..518051ed9fe 100644 --- a/test/conformance/behaviors/behaviors.go +++ b/test/conformance/behaviors/behaviors.go @@ -23,6 +23,7 @@ import ( "os" "path/filepath" "regexp" + "strings" "gopkg.in/yaml.v2" ) @@ -68,6 +69,9 @@ func ValidateSuite(suite *Suite) error { if _, ok := behaviorsByID[b.ID]; ok { errs = append(errs, fmt.Errorf("Duplicate behavior ID: %s", b.ID)) } + if !strings.HasPrefix(b.ID, suite.Suite) { + errs = append(errs, fmt.Errorf("Invalid behavior ID: %s, must have suite name as prefix: %s", b.ID, suite.Suite)) + } behaviorsByID[b.ID] = true } return utilerrors.NewAggregate(errs) diff --git a/test/conformance/behaviors/sig-network/service-spec.yaml b/test/conformance/behaviors/sig-network/service-spec.yaml index cb3228d8cdb..6beb9be2f98 100644 --- a/test/conformance/behaviors/sig-network/service-spec.yaml +++ b/test/conformance/behaviors/sig-network/service-spec.yaml @@ -1,30 +1,30 @@ suite: service/spec description: Base suite for services behaviors: -- id: service/basic-create/selector +- id: service/spec/selector/present-during-create description: When a Service resource is created with type "ClusterIP", "NodePort", or "LoadBalancer", and a selector is specified, an Endpoints object is generated based with the IPs of pods with label keys and values matching the selector. -- id: service/basic-create/no-selector +- id: service/spec/selector/absent-during-create description: When a Service resource is created and a no selector is specified, no changes are made to any corresponding Endpoints object. -- id: service/type/ClusterIP/empty +- id: service/spec/type/ClusterIP/empty description: When the Service type is specified as "ClusterIP" and the clusterIP field is empty, a cluster-internal IP address for load-balancing to endpoints is allocated. -- id: service/type/ClusterIP/static +- id: service/spec/type/ClusterIP/static description: When the Service type is specified as "ClusterIP" and the clusterIP field is specified as an IP address in the cluster service range, and that IP is not already assigned to another service, that IP is be allocated as a cluster-internal IP address for load-balancing to endpoints. -- id: service/type/ClusterIP/None +- id: service/spec/type/ClusterIP/None description: When the Service type is specified as "ClusterIP" and the clusterIP field is "None", no virtual IP is allocated and the endpoints are published as a set of endpoints rather than a stable IP. -- id: service/type/NodePort +- id: service/spec/type/NodePort description: When the Service type is specified as "NodePort" , a cluster-internal IP address for load-balancing to endpoints is allocated as for type "ClusterIP". Additionally, a cluster-wide port is allocated on every node, routing to the clusterIP. -- id: service/type/ExternalName +- id: service/spec/type/ExternalName description: When the Service type is specified as "ExternalName", the cluster DNS provider publishes a CNAME pointing from the service to the specified external name.