From 1ae53a15e655a9c002f8af9c7d9834187a6a5b57 Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Thu, 7 Nov 2019 10:58:53 -0800 Subject: [PATCH] Limiting the scope of new kubectl get e2e tests to decrease flakiness The `kubectl get output` e2e test I'd previously added ended up being flaky in certain e2e test scenarios. It relies on getting a list of API resources in the cluster and running `kubectl get` calls against them. The problem ended up being that other e2e tests could create resources that would cause this test to fail. This change limits the scope of the tests to not cover CRDs. This should still allow the test to catch new Kubernetes resources with improperly configured kubectl output while limiting the flakiness of the test. --- test/e2e/kubectl/kubectl.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 23e12b57503..2e89d326af1 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -438,13 +438,9 @@ var _ = SIGDescribe("Kubectl client", func() { "BackendConfig": true, "NodeMetrics": true, "PodMetrics": true, - "ScalingPolicy": true, "VolumeSnapshotClass": true, "VolumeSnapshotContent": true, "VolumeSnapshot": true, - - // A CRD created by other e2e tests without any test data. - "Noxu": true, } apiGroups, err := c.Discovery().ServerPreferredResources() @@ -453,6 +449,13 @@ var _ = SIGDescribe("Kubectl client", func() { testableResources := etcd.GetEtcdStorageDataForNamespace(f.Namespace.Name) for _, group := range apiGroups { + // This limits the scope of this test to exclude CRDs. This + // assumes that CRDs will not have a .k8s.io group and will have + // a . in their name. + if !strings.Contains(group.GroupVersion, ".k8s.io") && strings.Contains(group.GroupVersion, ".") { + continue + } + for _, resource := range group.APIResources { if !verbsContain(resource.Verbs, "get") || ignoredResources[resource.Kind] || strings.HasPrefix(resource.Name, "e2e-test") { continue