From 52885a8ec3b4f8381bea5f28a26323fe9e456633 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Wed, 17 Apr 2019 19:37:29 +0000 Subject: [PATCH] Check conformance test should not call any Skip Basically conformance test checks the target k8s cluster works all features which are specified in each test and that should not depend on any condition. This adds checking that conformance test should not call any Skip methods. And it detects the existing conformance test "creating/deleting custom resource definition objects works" calls framework.SkipUnlessServerVersionGTE(). So this removes the Skip also. --- hack/conformance/check_conformance_test_requirements.go | 8 ++++---- test/e2e/apimachinery/custom_resource_definition.go | 2 -- test/e2e/common/BUILD | 1 - test/e2e/common/downward_api.go | 8 -------- test/e2e/kubectl/kubectl.go | 3 --- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/hack/conformance/check_conformance_test_requirements.go b/hack/conformance/check_conformance_test_requirements.go index a0519483b9d..30897f1a151 100755 --- a/hack/conformance/check_conformance_test_requirements.go +++ b/hack/conformance/check_conformance_test_requirements.go @@ -34,7 +34,7 @@ const ( //e.g. framework.ConformanceIt("should provide secure master service ", func() { patternStartConformance = "framework.ConformanceIt\\(.*, func\\(\\) {$" patternEndConformance = "}\\)$" - patternSkipProviderIs = "Skip.*ProviderIs\\(" + patternSkip = "framework.Skip.*\\(" ) // This function checks the requirement: it works for all providers (e.g., no SkipIfProviderIs/SkipUnlessProviderIs calls) @@ -44,7 +44,7 @@ func checkAllProviders(e2eFile string) error { regStartConformance := regexp.MustCompile(patternStartConformance) regEndConformance := regexp.MustCompile(patternEndConformance) - regSkipProviderIs := regexp.MustCompile(patternSkipProviderIs) + regSkip := regexp.MustCompile(patternSkip) fileInput, err := ioutil.ReadFile(e2eFile) if err != nil { @@ -62,9 +62,9 @@ func checkAllProviders(e2eFile string) error { inConformanceCode = true } if inConformanceCode { - if regSkipProviderIs.MatchString(line) { + if regSkip.MatchString(line) { // To list all invalid places in a single operation of this tool, here doesn't return error and continues checking. - fmt.Fprintf(os.Stderr, "%v: Conformance test should not call SkipIfProviderIs()/SkipUnlessProviderIs()\n", e2eFile) + fmt.Fprintf(os.Stderr, "%v: Conformance test should not call any framework.Skip*()\n", e2eFile) checkFailed = true } if regEndConformance.MatchString(line) { diff --git a/test/e2e/apimachinery/custom_resource_definition.go b/test/e2e/apimachinery/custom_resource_definition.go index d3bc9d040a1..fd2aa81ac2f 100644 --- a/test/e2e/apimachinery/custom_resource_definition.go +++ b/test/e2e/apimachinery/custom_resource_definition.go @@ -40,8 +40,6 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() { */ framework.ConformanceIt("creating/deleting custom resource definition objects works ", func() { - framework.SkipUnlessServerVersionGTE(crdVersion, f.ClientSet.Discovery()) - config, err := framework.LoadConfig() if err != nil { framework.Failf("failed to load config: %v", err) diff --git a/test/e2e/common/BUILD b/test/e2e/common/BUILD index e11f5b83cfc..60e89b72a3c 100644 --- a/test/e2e/common/BUILD +++ b/test/e2e/common/BUILD @@ -69,7 +69,6 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", - "//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", diff --git a/test/e2e/common/downward_api.go b/test/e2e/common/downward_api.go index d1169ed21f8..a2c51d8c953 100644 --- a/test/e2e/common/downward_api.go +++ b/test/e2e/common/downward_api.go @@ -23,18 +23,12 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" - utilversion "k8s.io/apimachinery/pkg/util/version" "k8s.io/kubernetes/test/e2e/framework" imageutils "k8s.io/kubernetes/test/utils/image" . "github.com/onsi/ginkgo" ) -var ( - hostIPVersion = utilversion.MustParseSemantic("v1.8.0") - podUIDVersion = utilversion.MustParseSemantic("v1.8.0") -) - var _ = Describe("[sig-node] Downward API", func() { f := framework.NewDefaultFramework("downward-api") @@ -90,7 +84,6 @@ var _ = Describe("[sig-node] Downward API", func() { Description: Downward API MUST expose Pod and Container fields as environment variables. Specify host IP as environment variable in the Pod Spec are visible at runtime in the container. */ framework.ConformanceIt("should provide host IP as an env var [NodeConformance]", func() { - framework.SkipUnlessServerVersionGTE(hostIPVersion, f.ClientSet.Discovery()) podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { @@ -218,7 +211,6 @@ var _ = Describe("[sig-node] Downward API", func() { Description: Downward API MUST expose Pod UID set through environment variables at runtime in the container. */ framework.ConformanceIt("should provide pod UID as env vars [NodeConformance]", func() { - framework.SkipUnlessServerVersionGTE(podUIDVersion, f.ClientSet.Discovery()) podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 1a3ca537c6b..6f4e33608eb 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -944,9 +944,6 @@ metadata: Description: Deploy a redis controller and a redis service. Kubectl describe pods SHOULD return the name, namespace, labels, state and other information as expected. Kubectl describe on rc, service, node and namespace SHOULD also return proper information. */ framework.ConformanceIt("should check if kubectl describe prints relevant information for rc and pods ", func() { - kv, err := framework.KubectlVersion() - framework.ExpectNoError(err) - framework.SkipUnlessServerVersionGTE(kv, c.Discovery()) controllerJSON := commonutils.SubstituteImageName(string(readTestFileOrDie(redisControllerFilename))) serviceJSON := readTestFileOrDie(redisServiceFilename)