From a5967cbaf10e949aaa6e72ff6272fe018bcf2526 Mon Sep 17 00:00:00 2001 From: Matt Liggett Date: Thu, 26 Oct 2017 10:46:09 -0700 Subject: [PATCH 1/3] Add framework.ConformanceIt as the new way to declare conformance tests. Also rewrite all existing conformance tests to use this. --- .../custom_resource_definition.go | 2 +- test/e2e/apps/rc.go | 2 +- test/e2e/apps/replica_set.go | 2 +- test/e2e/auth/service_accounts.go | 4 +- test/e2e/common/configmap.go | 4 +- test/e2e/common/configmap_volume.go | 18 +++--- test/e2e/common/container_probe.go | 16 +++--- test/e2e/common/docker_containers.go | 10 ++-- test/e2e/common/downward_api.go | 12 ++-- test/e2e/common/downwardapi_volume.go | 22 ++++---- test/e2e/common/empty_dir.go | 28 +++++----- test/e2e/common/expansion.go | 8 +-- test/e2e/common/host_path.go | 2 +- test/e2e/common/kubelet_etc_hosts.go | 2 +- test/e2e/common/networking.go | 8 +-- test/e2e/common/pods.go | 10 ++-- test/e2e/common/projected.go | 56 +++++++++---------- test/e2e/common/secrets.go | 4 +- test/e2e/common/secrets_volume.go | 14 ++--- test/e2e/events.go | 2 +- test/e2e/framework/framework.go | 5 ++ test/e2e/kubectl/kubectl.go | 44 +++++++-------- test/e2e/network/dns.go | 4 +- test/e2e/network/proxy.go | 10 ++-- test/e2e/network/service.go | 6 +- test/e2e/network/service_latency.go | 2 +- test/e2e/pods.go | 4 +- test/e2e/pre_stop.go | 2 +- test/e2e/scheduling/predicates.go | 6 +- 29 files changed, 155 insertions(+), 154 deletions(-) diff --git a/test/e2e/apimachinery/custom_resource_definition.go b/test/e2e/apimachinery/custom_resource_definition.go index aa18a77fd24..b9bf37fe403 100644 --- a/test/e2e/apimachinery/custom_resource_definition.go +++ b/test/e2e/apimachinery/custom_resource_definition.go @@ -33,7 +33,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() { f := framework.NewDefaultFramework("custom-resource-definition") Context("Simple CustomResourceDefinition", func() { - It("creating/deleting custom resource definition objects works [Conformance]", func() { + framework.ConformanceIt("creating/deleting custom resource definition objects works ", func() { framework.SkipUnlessServerVersionGTE(crdVersion, f.ClientSet.Discovery()) diff --git a/test/e2e/apps/rc.go b/test/e2e/apps/rc.go index 6679fbfd350..3b1bffb05c3 100644 --- a/test/e2e/apps/rc.go +++ b/test/e2e/apps/rc.go @@ -38,7 +38,7 @@ import ( var _ = SIGDescribe("ReplicationController", func() { f := framework.NewDefaultFramework("replication-controller") - It("should serve a basic image on each replica with a public image [Conformance]", func() { + framework.ConformanceIt("should serve a basic image on each replica with a public image ", func() { TestReplicationControllerServeImageOrFail(f, "basic", framework.ServeHostnameImage) }) diff --git a/test/e2e/apps/replica_set.go b/test/e2e/apps/replica_set.go index e2d00f261bd..2368e2545a2 100644 --- a/test/e2e/apps/replica_set.go +++ b/test/e2e/apps/replica_set.go @@ -78,7 +78,7 @@ func newPodQuota(name, number string) *v1.ResourceQuota { var _ = SIGDescribe("ReplicaSet", func() { f := framework.NewDefaultFramework("replicaset") - It("should serve a basic image on each replica with a public image [Conformance]", func() { + framework.ConformanceIt("should serve a basic image on each replica with a public image ", func() { testReplicaSetServeImageOrFail(f, "basic", framework.ServeHostnameImage) }) diff --git a/test/e2e/auth/service_accounts.go b/test/e2e/auth/service_accounts.go index 9ac771e0f8d..aa416ddc34c 100644 --- a/test/e2e/auth/service_accounts.go +++ b/test/e2e/auth/service_accounts.go @@ -158,7 +158,7 @@ var _ = SIGDescribe("ServiceAccounts", func() { } }) - It("should mount an API token into pods [Conformance]", func() { + framework.ConformanceIt("should mount an API token into pods ", func() { var tokenContent string var rootCAContent string @@ -245,7 +245,7 @@ var _ = SIGDescribe("ServiceAccounts", func() { } }) - It("should allow opting out of API token automount [Conformance]", func() { + framework.ConformanceIt("should allow opting out of API token automount ", func() { framework.SkipUnlessServerVersionGTE(serviceAccountTokenAutomountVersion, f.ClientSet.Discovery()) var err error diff --git a/test/e2e/common/configmap.go b/test/e2e/common/configmap.go index b1f4331c43e..03cefaab9a7 100644 --- a/test/e2e/common/configmap.go +++ b/test/e2e/common/configmap.go @@ -29,7 +29,7 @@ import ( var _ = Describe("[sig-api-machinery] ConfigMap", func() { f := framework.NewDefaultFramework("configmap") - It("should be consumable via environment variable [Conformance]", func() { + framework.ConformanceIt("should be consumable via environment variable ", func() { name := "configmap-test-" + string(uuid.NewUUID()) configMap := newConfigMap(f, name) By(fmt.Sprintf("Creating configMap %v/%v", f.Namespace.Name, configMap.Name)) @@ -72,7 +72,7 @@ var _ = Describe("[sig-api-machinery] ConfigMap", func() { }) }) - It("should be consumable via the environment [Conformance]", func() { + framework.ConformanceIt("should be consumable via the environment ", func() { name := "configmap-test-" + string(uuid.NewUUID()) configMap := newEnvFromConfigMap(f, name) By(fmt.Sprintf("Creating configMap %v/%v", f.Namespace.Name, configMap.Name)) diff --git a/test/e2e/common/configmap_volume.go b/test/e2e/common/configmap_volume.go index 8595caf4009..82ccc4ecd4e 100644 --- a/test/e2e/common/configmap_volume.go +++ b/test/e2e/common/configmap_volume.go @@ -32,11 +32,11 @@ import ( var _ = Describe("[sig-storage] ConfigMap", func() { f := framework.NewDefaultFramework("configmap") - It("should be consumable from pods in volume [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume ", func() { doConfigMapE2EWithoutMappings(f, 0, 0, nil) }) - It("should be consumable from pods in volume with defaultMode set [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with defaultMode set ", func() { defaultMode := int32(0400) doConfigMapE2EWithoutMappings(f, 0, 0, &defaultMode) }) @@ -46,7 +46,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { doConfigMapE2EWithoutMappings(f, 1000, 1001, &defaultMode) }) - It("should be consumable from pods in volume as non-root [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume as non-root ", func() { doConfigMapE2EWithoutMappings(f, 1000, 0, nil) }) @@ -54,16 +54,16 @@ var _ = Describe("[sig-storage] ConfigMap", func() { doConfigMapE2EWithoutMappings(f, 1000, 1001, nil) }) - It("should be consumable from pods in volume with mappings [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings ", func() { doConfigMapE2EWithMappings(f, 0, 0, nil) }) - It("should be consumable from pods in volume with mappings and Item mode set[Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings and Item mode set", func() { mode := int32(0400) doConfigMapE2EWithMappings(f, 0, 0, &mode) }) - It("should be consumable from pods in volume with mappings as non-root [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings as non-root ", func() { doConfigMapE2EWithMappings(f, 1000, 0, nil) }) @@ -71,7 +71,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { doConfigMapE2EWithMappings(f, 1000, 1001, nil) }) - It("updates should be reflected in volume [Conformance]", func() { + framework.ConformanceIt("updates should be reflected in volume ", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) @@ -149,7 +149,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { Eventually(pollLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("value-2")) }) - It("optional updates should be reflected in volume [Conformance]", func() { + framework.ConformanceIt("optional updates should be reflected in volume ", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) trueVal := true @@ -327,7 +327,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { Eventually(pollDeleteLogs, podLogTimeout, framework.Poll).Should(ContainSubstring("Error reading file /etc/configmap-volumes/delete/data-1")) }) - It("should be consumable in multiple volumes in the same pod [Conformance]", func() { + framework.ConformanceIt("should be consumable in multiple volumes in the same pod ", func() { var ( name = "configmap-test-volume-" + string(uuid.NewUUID()) volumeName = "configmap-volume" diff --git a/test/e2e/common/container_probe.go b/test/e2e/common/container_probe.go index f0c949863b6..459df0d0cc1 100644 --- a/test/e2e/common/container_probe.go +++ b/test/e2e/common/container_probe.go @@ -54,7 +54,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure that pod with readiness probe should not be ready before initial delay and never restart. */ - It("with readiness probe should not be ready before initial delay and never restart [Conformance]", func() { + framework.ConformanceIt("with readiness probe should not be ready before initial delay and never restart ", func() { p := podClient.Create(makePodSpec(probe.withInitialDelay().build(), nil)) f.WaitForPodReady(p.Name) @@ -86,7 +86,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure that pod with readiness probe that fails should never be ready and never restart. */ - It("with readiness probe that fails should never be ready and never restart [Conformance]", func() { + framework.ConformanceIt("with readiness probe that fails should never be ready and never restart ", func() { p := podClient.Create(makePodSpec(probe.withFailing().build(), nil)) Consistently(func() (bool, error) { p, err := podClient.Get(p.Name, metav1.GetOptions{}) @@ -111,7 +111,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure the pod is restarted with a cat /tmp/health liveness probe. */ - It("should be restarted with a exec \"cat /tmp/health\" liveness probe [Conformance]", func() { + framework.ConformanceIt("should be restarted with a exec \"cat /tmp/health\" liveness probe", func() { runLivenessTest(f, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "liveness-exec", @@ -143,7 +143,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure the pod is not restarted with a cat /tmp/health liveness probe. */ - It("should *not* be restarted with a exec \"cat /tmp/health\" liveness probe [Conformance]", func() { + framework.ConformanceIt("should *not* be restarted with a exec \"cat /tmp/health\" liveness probe", func() { runLivenessTest(f, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "liveness-exec", @@ -175,7 +175,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure when http liveness probe fails, the pod should be restarted. */ - It("should be restarted with a /healthz http liveness probe [Conformance]", func() { + framework.ConformanceIt("should be restarted with a /healthz http liveness probe ", func() { runLivenessTest(f, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "liveness-http", @@ -209,7 +209,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure when a pod gets restarted, its start count should increase. */ - It("should have monotonically increasing restart count [Conformance] [Slow]", func() { + framework.ConformanceIt("should have monotonically increasing restart count [Slow]", func() { runLivenessTest(f, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "liveness-http", @@ -242,7 +242,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure when http liveness probe succeeds, the pod should not be restarted. */ - It("should *not* be restarted with a /healthz http liveness probe [Conformance]", func() { + framework.ConformanceIt("should *not* be restarted with a /healthz http liveness probe ", func() { runLivenessTest(f, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "liveness-http", @@ -276,7 +276,7 @@ var _ = framework.KubeDescribe("Probing container", func() { Description: Make sure that the pod is restarted with a docker exec liveness probe with timeout. */ - It("should be restarted with a docker exec liveness probe with timeout [Conformance]", func() { + framework.ConformanceIt("should be restarted with a docker exec liveness probe with timeout ", func() { // TODO: enable this test once the default exec handler supports timeout. framework.Skipf("The default exec handler, dockertools.NativeExecHandler, does not support timeouts due to a limitation in the Docker Remote API") runLivenessTest(f, &v1.Pod{ diff --git a/test/e2e/common/docker_containers.go b/test/e2e/common/docker_containers.go index c527976d596..dea3be317fd 100644 --- a/test/e2e/common/docker_containers.go +++ b/test/e2e/common/docker_containers.go @@ -22,20 +22,18 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/kubernetes/test/e2e/framework" imageutils "k8s.io/kubernetes/test/utils/image" - - . "github.com/onsi/ginkgo" ) var _ = framework.KubeDescribe("Docker Containers", func() { f := framework.NewDefaultFramework("containers") - It("should use the image defaults if command and args are blank [Conformance]", func() { + framework.ConformanceIt("should use the image defaults if command and args are blank ", func() { f.TestContainerOutput("use defaults", entrypointTestPod(), 0, []string{ "[/ep default arguments]", }) }) - It("should be able to override the image's default arguments (docker cmd) [Conformance]", func() { + framework.ConformanceIt("should be able to override the image's default arguments (docker cmd) ", func() { pod := entrypointTestPod() pod.Spec.Containers[0].Args = []string{"override", "arguments"} @@ -46,7 +44,7 @@ var _ = framework.KubeDescribe("Docker Containers", func() { // Note: when you override the entrypoint, the image's arguments (docker cmd) // are ignored. - It("should be able to override the image's default commmand (docker entrypoint) [Conformance]", func() { + framework.ConformanceIt("should be able to override the image's default commmand (docker entrypoint) ", func() { pod := entrypointTestPod() pod.Spec.Containers[0].Command = []string{"/ep-2"} @@ -55,7 +53,7 @@ var _ = framework.KubeDescribe("Docker Containers", func() { }) }) - It("should be able to override the image's default command and arguments [Conformance]", func() { + framework.ConformanceIt("should be able to override the image's default command and arguments ", func() { pod := entrypointTestPod() pod.Spec.Containers[0].Command = []string{"/ep-2"} pod.Spec.Containers[0].Args = []string{"override", "arguments"} diff --git a/test/e2e/common/downward_api.go b/test/e2e/common/downward_api.go index d271e804671..e6e3a979d45 100644 --- a/test/e2e/common/downward_api.go +++ b/test/e2e/common/downward_api.go @@ -37,7 +37,7 @@ var ( var _ = Describe("[sig-api-machinery] Downward API", func() { f := framework.NewDefaultFramework("downward-api") - It("should provide pod name and namespace as env vars [Conformance]", func() { + framework.ConformanceIt("should provide pod name and namespace as env vars ", func() { podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { @@ -68,7 +68,7 @@ var _ = Describe("[sig-api-machinery] Downward API", func() { testDownwardAPI(f, podName, env, expectations) }) - It("should provide pod IP as an env var [Conformance]", func() { + framework.ConformanceIt("should provide pod IP as an env var ", func() { podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { @@ -89,7 +89,7 @@ var _ = Describe("[sig-api-machinery] Downward API", func() { testDownwardAPI(f, podName, env, expectations) }) - It("should provide host IP as an env var [Conformance]", func() { + framework.ConformanceIt("should provide host IP as an env var ", func() { framework.SkipUnlessServerVersionGTE(hostIPVersion, f.ClientSet.Discovery()) podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ @@ -111,7 +111,7 @@ var _ = Describe("[sig-api-machinery] Downward API", func() { testDownwardAPI(f, podName, env, expectations) }) - It("should provide container's limits.cpu/memory and requests.cpu/memory as env vars [Conformance]", func() { + framework.ConformanceIt("should provide container's limits.cpu/memory and requests.cpu/memory as env vars ", func() { podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { @@ -157,7 +157,7 @@ var _ = Describe("[sig-api-machinery] Downward API", func() { testDownwardAPI(f, podName, env, expectations) }) - It("should provide default limits.cpu/memory from node allocatable [Conformance]", func() { + framework.ConformanceIt("should provide default limits.cpu/memory from node allocatable ", func() { podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ { @@ -202,7 +202,7 @@ var _ = Describe("[sig-api-machinery] Downward API", func() { testDownwardAPIUsingPod(f, pod, env, expectations) }) - It("should provide pod UID as env vars [Conformance]", func() { + framework.ConformanceIt("should provide pod UID as env vars ", func() { framework.SkipUnlessServerVersionGTE(podUIDVersion, f.ClientSet.Discovery()) podName := "downward-api-" + string(uuid.NewUUID()) env := []v1.EnvVar{ diff --git a/test/e2e/common/downwardapi_volume.go b/test/e2e/common/downwardapi_volume.go index 34bb566eed0..b5a0299e20c 100644 --- a/test/e2e/common/downwardapi_volume.go +++ b/test/e2e/common/downwardapi_volume.go @@ -39,7 +39,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { podClient = f.PodClient() }) - It("should provide podname only [Conformance]", func() { + framework.ConformanceIt("should provide podname only ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumePodForSimpleTest(podName, "/etc/podname") @@ -48,7 +48,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should set DefaultMode on files [Conformance]", func() { + framework.ConformanceIt("should set DefaultMode on files ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) defaultMode := int32(0400) pod := downwardAPIVolumePodForModeTest(podName, "/etc/podname", nil, &defaultMode) @@ -58,7 +58,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should set mode on item file [Conformance]", func() { + framework.ConformanceIt("should set mode on item file ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) mode := int32(0400) pod := downwardAPIVolumePodForModeTest(podName, "/etc/podname", &mode, nil) @@ -97,7 +97,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should update labels on modification [Conformance]", func() { + framework.ConformanceIt("should update labels on modification ", func() { labels := map[string]string{} labels["key1"] = "value1" labels["key2"] = "value2" @@ -124,7 +124,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { podLogTimeout, framework.Poll).Should(ContainSubstring("key3=\"value3\"\n")) }) - It("should update annotations on modification [Conformance]", func() { + framework.ConformanceIt("should update annotations on modification ", func() { annotations := map[string]string{} annotations["builder"] = "bar" podName := "annotationupdate" + string(uuid.NewUUID()) @@ -153,7 +153,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { podLogTimeout, framework.Poll).Should(ContainSubstring("builder=\"foo\"\n")) }) - It("should provide container's cpu limit [Conformance]", func() { + framework.ConformanceIt("should provide container's cpu limit ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/cpu_limit") @@ -162,7 +162,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should provide container's memory limit [Conformance]", func() { + framework.ConformanceIt("should provide container's memory limit ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/memory_limit") @@ -171,7 +171,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should provide container's cpu request [Conformance]", func() { + framework.ConformanceIt("should provide container's cpu request ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/cpu_request") @@ -180,7 +180,7 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should provide container's memory request [Conformance]", func() { + framework.ConformanceIt("should provide container's memory request ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/memory_request") @@ -189,14 +189,14 @@ var _ = Describe("[sig-storage] Downward API volume", func() { }) }) - It("should provide node allocatable (cpu) as default cpu limit if the limit is not set [Conformance]", func() { + framework.ConformanceIt("should provide node allocatable (cpu) as default cpu limit if the limit is not set ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForDefaultContainerResources(podName, "/etc/cpu_limit") f.TestContainerOutputRegexp("downward API volume plugin", pod, 0, []string{"[1-9]"}) }) - It("should provide node allocatable (memory) as default memory limit if the limit is not set [Conformance]", func() { + framework.ConformanceIt("should provide node allocatable (memory) as default memory limit if the limit is not set ", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForDefaultContainerResources(podName, "/etc/memory_limit") diff --git a/test/e2e/common/empty_dir.go b/test/e2e/common/empty_dir.go index 06b7fc271c0..cdfe0cb4548 100644 --- a/test/e2e/common/empty_dir.go +++ b/test/e2e/common/empty_dir.go @@ -68,59 +68,59 @@ var _ = framework.KubeDescribe("EmptyDir volumes", func() { }) }) - It("volume on tmpfs should have the correct mode [Conformance] [sig-storage]", func() { + framework.ConformanceIt("volume on tmpfs should have the correct mode [sig-storage]", func() { doTestVolumeMode(f, testImageRootUid, v1.StorageMediumMemory) }) - It("should support (root,0644,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0644,tmpfs) [sig-storage]", func() { doTest0644(f, testImageRootUid, v1.StorageMediumMemory) }) - It("should support (root,0666,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0666,tmpfs) [sig-storage]", func() { doTest0666(f, testImageRootUid, v1.StorageMediumMemory) }) - It("should support (root,0777,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0777,tmpfs) [sig-storage]", func() { doTest0777(f, testImageRootUid, v1.StorageMediumMemory) }) - It("should support (non-root,0644,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0644,tmpfs) [sig-storage]", func() { doTest0644(f, testImageNonRootUid, v1.StorageMediumMemory) }) - It("should support (non-root,0666,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0666,tmpfs) [sig-storage]", func() { doTest0666(f, testImageNonRootUid, v1.StorageMediumMemory) }) - It("should support (non-root,0777,tmpfs) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0777,tmpfs) [sig-storage]", func() { doTest0777(f, testImageNonRootUid, v1.StorageMediumMemory) }) - It("volume on default medium should have the correct mode [Conformance] [sig-storage]", func() { + framework.ConformanceIt("volume on default medium should have the correct mode [sig-storage]", func() { doTestVolumeMode(f, testImageRootUid, v1.StorageMediumDefault) }) - It("should support (root,0644,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0644,default) [sig-storage]", func() { doTest0644(f, testImageRootUid, v1.StorageMediumDefault) }) - It("should support (root,0666,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0666,default) [sig-storage]", func() { doTest0666(f, testImageRootUid, v1.StorageMediumDefault) }) - It("should support (root,0777,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (root,0777,default) [sig-storage]", func() { doTest0777(f, testImageRootUid, v1.StorageMediumDefault) }) - It("should support (non-root,0644,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0644,default) [sig-storage]", func() { doTest0644(f, testImageNonRootUid, v1.StorageMediumDefault) }) - It("should support (non-root,0666,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0666,default) [sig-storage]", func() { doTest0666(f, testImageNonRootUid, v1.StorageMediumDefault) }) - It("should support (non-root,0777,default) [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should support (non-root,0777,default) [sig-storage]", func() { doTest0777(f, testImageNonRootUid, v1.StorageMediumDefault) }) }) diff --git a/test/e2e/common/expansion.go b/test/e2e/common/expansion.go index 0e0e8f18697..303df66f952 100644 --- a/test/e2e/common/expansion.go +++ b/test/e2e/common/expansion.go @@ -21,8 +21,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/kubernetes/test/e2e/framework" - - . "github.com/onsi/ginkgo" ) // These tests exercise the Kubernetes expansion syntax $(VAR). @@ -36,7 +34,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { Description: Make sure environment variables can be set using an expansion of previously defined environment variables */ - It("should allow composing env vars into new env vars [Conformance]", func() { + framework.ConformanceIt("should allow composing env vars into new env vars ", func() { podName := "var-expansion-" + string(uuid.NewUUID()) pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -81,7 +79,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { Description: Make sure a container's commands can be set using an expansion of environment variables. */ - It("should allow substituting values in a container's command [Conformance]", func() { + framework.ConformanceIt("should allow substituting values in a container's command ", func() { podName := "var-expansion-" + string(uuid.NewUUID()) pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -116,7 +114,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { Description: Make sure a container's args can be set using an expansion of environment variables. */ - It("should allow substituting values in a container's args [Conformance]", func() { + framework.ConformanceIt("should allow substituting values in a container's args ", func() { podName := "var-expansion-" + string(uuid.NewUUID()) pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ diff --git a/test/e2e/common/host_path.go b/test/e2e/common/host_path.go index dbe80924f8a..4eb29d955b2 100644 --- a/test/e2e/common/host_path.go +++ b/test/e2e/common/host_path.go @@ -40,7 +40,7 @@ var _ = framework.KubeDescribe("HostPath", func() { _ = os.Remove("/tmp/test-file") }) - It("should give a volume the correct mode [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should give a volume the correct mode [sig-storage]", func() { source := &v1.HostPathVolumeSource{ Path: "/tmp", } diff --git a/test/e2e/common/kubelet_etc_hosts.go b/test/e2e/common/kubelet_etc_hosts.go index 72ba28c5e79..0f4fdac897d 100644 --- a/test/e2e/common/kubelet_etc_hosts.go +++ b/test/e2e/common/kubelet_etc_hosts.go @@ -48,7 +48,7 @@ var _ = framework.KubeDescribe("KubeletManagedEtcHosts", func() { f: f, } - It("should test kubelet managed /etc/hosts file [Conformance]", func() { + framework.ConformanceIt("should test kubelet managed /etc/hosts file ", func() { By("Setting up the test") config.setup() diff --git a/test/e2e/common/networking.go b/test/e2e/common/networking.go index b60586d6f28..1cb46071999 100644 --- a/test/e2e/common/networking.go +++ b/test/e2e/common/networking.go @@ -35,7 +35,7 @@ var _ = Describe("[sig-network] Networking", func() { Description: Try to hit test endpoints from a test container and make sure each of them can report a unique hostname. */ - It("should function for intra-pod communication: http [Conformance]", func() { + framework.ConformanceIt("should function for intra-pod communication: http ", func() { config := framework.NewCoreNetworkingTestConfig(f) for _, endpointPod := range config.EndpointPods { config.DialFromTestContainer("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) @@ -47,7 +47,7 @@ var _ = Describe("[sig-network] Networking", func() { Description: Try to hit test endpoints from a test container using udp and make sure each of them can report a unique hostname. */ - It("should function for intra-pod communication: udp [Conformance]", func() { + framework.ConformanceIt("should function for intra-pod communication: udp ", func() { config := framework.NewCoreNetworkingTestConfig(f) for _, endpointPod := range config.EndpointPods { config.DialFromTestContainer("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) @@ -59,7 +59,7 @@ var _ = Describe("[sig-network] Networking", func() { Description: Try to hit test endpoints from the pod and make sure each of them can report a unique hostname. */ - It("should function for node-pod communication: http [Conformance]", func() { + framework.ConformanceIt("should function for node-pod communication: http ", func() { config := framework.NewCoreNetworkingTestConfig(f) for _, endpointPod := range config.EndpointPods { config.DialFromNode("http", endpointPod.Status.PodIP, framework.EndpointHttpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) @@ -71,7 +71,7 @@ var _ = Describe("[sig-network] Networking", func() { Description: Try to hit test endpoints from the pod using udp and make sure each of them can report a unique hostname. */ - It("should function for node-pod communication: udp [Conformance]", func() { + framework.ConformanceIt("should function for node-pod communication: udp ", func() { config := framework.NewCoreNetworkingTestConfig(f) for _, endpointPod := range config.EndpointPods { config.DialFromNode("udp", endpointPod.Status.PodIP, framework.EndpointUdpPort, config.MaxTries, 0, sets.NewString(endpointPod.Name)) diff --git a/test/e2e/common/pods.go b/test/e2e/common/pods.go index bc58a8c6b47..755011fb5ae 100644 --- a/test/e2e/common/pods.go +++ b/test/e2e/common/pods.go @@ -133,7 +133,7 @@ var _ = framework.KubeDescribe("Pods", func() { Description: Make sure when a pod is created that it is assigned a host IP Address. */ - It("should get a host IP [Conformance]", func() { + framework.ConformanceIt("should get a host IP ", func() { name := "pod-hostip-" + string(uuid.NewUUID()) testHostIP(podClient, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -155,7 +155,7 @@ var _ = framework.KubeDescribe("Pods", func() { Description: Makes sure a pod is created, a watch can be setup for the pod, pod creation was observed, pod is deleted, and pod deletion is observed. */ - It("should be submitted and removed [Conformance]", func() { + framework.ConformanceIt("should be submitted and removed ", func() { By("creating the pod") name := "pod-submit-remove-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -280,7 +280,7 @@ var _ = framework.KubeDescribe("Pods", func() { Testname: pods-updated-successfully Description: Make sure it is possible to successfully update a pod's labels. */ - It("should be updated [Conformance]", func() { + framework.ConformanceIt("should be updated ", func() { By("creating the pod") name := "pod-update-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -335,7 +335,7 @@ var _ = framework.KubeDescribe("Pods", func() { activeDeadlineSecondsValue, and then waits for the deadline to pass and verifies the pod is terminated. */ - It("should allow activeDeadlineSeconds to be updated [Conformance]", func() { + framework.ConformanceIt("should allow activeDeadlineSeconds to be updated ", func() { By("creating the pod") name := "pod-update-activedeadlineseconds-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -381,7 +381,7 @@ var _ = framework.KubeDescribe("Pods", func() { Description: Make sure that when a pod is created it contains environment variables for each active service. */ - It("should contain environment variables for services [Conformance]", func() { + framework.ConformanceIt("should contain environment variables for services ", func() { // Make a pod that will be a service. // This pod serves its hostname via HTTP. serverName := "server-envvars-" + string(uuid.NewUUID()) diff --git a/test/e2e/common/projected.go b/test/e2e/common/projected.go index 2e568263e49..f560703b392 100644 --- a/test/e2e/common/projected.go +++ b/test/e2e/common/projected.go @@ -39,7 +39,7 @@ var _ = framework.KubeDescribe("Projected", func() { Testname: projected-secret-no-defaultMode Description: Simple projected Secret test with no defaultMode set. */ - It("should be consumable from pods in volume [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume [sig-storage]", func() { doProjectedSecretE2EWithoutMapping(f, nil /* default mode */, "projected-secret-test-"+string(uuid.NewUUID()), nil, nil) }) @@ -47,7 +47,7 @@ var _ = framework.KubeDescribe("Projected", func() { Testname: projected-secret-with-defaultMode Description: Simple projected Secret test with defaultMode set. */ - It("should be consumable from pods in volume with defaultMode set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with defaultMode set [sig-storage]", func() { defaultMode := int32(0400) doProjectedSecretE2EWithoutMapping(f, &defaultMode, "projected-secret-test-"+string(uuid.NewUUID()), nil, nil) }) @@ -57,7 +57,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Simple projected Secret test as non-root with defaultMode and fsGroup set. */ - It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [sig-storage]", func() { defaultMode := int32(0440) /* setting fsGroup sets mode to at least 440 */ fsGroup := int64(1001) uid := int64(1000) @@ -70,7 +70,7 @@ var _ = framework.KubeDescribe("Projected", func() { mounting it to a volume with a custom path (mapping) on the pod with no other settings and make sure the pod actually consumes it. */ - It("should be consumable from pods in volume with mappings [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings [sig-storage]", func() { doProjectedSecretE2EWithMapping(f, nil) }) @@ -79,7 +79,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Repeat the projected-secret-simple-mapped but this time with an item mode (e.g. 0400) for the secret map item. */ - It("should be consumable from pods in volume with mappings and Item Mode set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings and Item Mode set [sig-storage]", func() { mode := int32(0400) doProjectedSecretE2EWithMapping(f, &mode) }) @@ -110,7 +110,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Make sure secrets works when mounted as two different volumes on the same node. */ - It("should be consumable in multiple volumes in a pod [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable in multiple volumes in a pod [sig-storage]", func() { // This test ensures that the same secret can be mounted in multiple // volumes in the same pod. This test case exists to prevent // regressions that break this use-case. @@ -203,7 +203,7 @@ var _ = framework.KubeDescribe("Projected", func() { Testname: projected-secret-simple-optional Description: Make sure secrets works when optional updates included. */ - It("optional updates should be reflected in volume [Conformance] [sig-storage]", func() { + framework.ConformanceIt("optional updates should be reflected in volume [sig-storage]", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) trueVal := true @@ -405,7 +405,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Make sure that a projected volume with a configMap with no mappings succeeds properly. */ - It("should be consumable from pods in volume [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume [sig-storage]", func() { doProjectedConfigMapE2EWithoutMappings(f, 0, 0, nil) }) @@ -414,7 +414,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Make sure that a projected volume configMap is consumable with defaultMode set. */ - It("should be consumable from pods in volume with defaultMode set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with defaultMode set [sig-storage]", func() { defaultMode := int32(0400) doProjectedConfigMapE2EWithoutMappings(f, 0, 0, &defaultMode) }) @@ -429,7 +429,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Make sure that a projected volume configMap is consumable by a non-root userID. */ - It("should be consumable from pods in volume as non-root [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume as non-root [sig-storage]", func() { doProjectedConfigMapE2EWithoutMappings(f, 1000, 0, nil) }) @@ -443,7 +443,7 @@ var _ = framework.KubeDescribe("Projected", func() { map and mounting it to a volume with a custom path (mapping) on the pod with no other settings and make sure the pod actually consumes it. */ - It("should be consumable from pods in volume with mappings [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings [sig-storage]", func() { doProjectedConfigMapE2EWithMappings(f, 0, 0, nil) }) @@ -452,7 +452,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Repeat the projected-secret-simple-mapped but this time with an item mode (e.g. 0400) for the secret map item */ - It("should be consumable from pods in volume with mappings and Item mode set[Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings and Item mode set [sig-storage]", func() { mode := int32(0400) doProjectedConfigMapE2EWithMappings(f, 0, 0, &mode) }) @@ -462,7 +462,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Repeat the projected-config-map-simple-mapped but this time with a user other than root. */ - It("should be consumable from pods in volume with mappings as non-root [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings as non-root [sig-storage]", func() { doProjectedConfigMapE2EWithMappings(f, 1000, 0, nil) }) @@ -476,7 +476,7 @@ var _ = framework.KubeDescribe("Projected", func() { that the values in these configMaps can be updated, deleted, and created. */ - It("updates should be reflected in volume [Conformance] [sig-storage]", func() { + framework.ConformanceIt("updates should be reflected in volume [sig-storage]", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) @@ -565,7 +565,7 @@ var _ = framework.KubeDescribe("Projected", func() { configMaps, that the values in these configMaps can be updated, deleted, and created. */ - It("optional updates should be reflected in volume [Conformance] [sig-storage]", func() { + framework.ConformanceIt("optional updates should be reflected in volume [sig-storage]", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) trueVal := true @@ -766,7 +766,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Make sure config map works when it mounted as two different volumes on the same node. */ - It("should be consumable in multiple volumes in the same pod [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should be consumable in multiple volumes in the same pod [sig-storage]", func() { var ( name = "projected-configmap-test-volume-" + string(uuid.NewUUID()) volumeName = "projected-configmap-volume" @@ -864,7 +864,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can provide pod's name through DownwardAPIVolumeFiles in a projected volume. */ - It("should provide podname only [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide podname only [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumePodForSimpleTest(podName, "/etc/podname") @@ -879,7 +879,7 @@ var _ = framework.KubeDescribe("Projected", func() { mode for DownwardAPIVolumeFiles if no mode is specified in a projected volume. */ - It("should set DefaultMode on files [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should set DefaultMode on files [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) defaultMode := int32(0400) pod := projectedDownwardAPIVolumePodForModeTest(podName, "/etc/podname", nil, &defaultMode) @@ -894,7 +894,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can set file premission mode for DownwardAPIVolumeFiles in a projected volume. */ - It("should set mode on item file [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should set mode on item file [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) mode := int32(0400) pod := projectedDownwardAPIVolumePodForModeTest(podName, "/etc/podname", &mode, nil) @@ -939,7 +939,7 @@ var _ = framework.KubeDescribe("Projected", func() { DownwardAPIVolumeFiles when pod's labels get modified in a projected volume. */ - It("should update labels on modification [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should update labels on modification [sig-storage]", func() { labels := map[string]string{} labels["key1"] = "value1" labels["key2"] = "value2" @@ -972,7 +972,7 @@ var _ = framework.KubeDescribe("Projected", func() { DownwardAPIVolumeFiles when pod's annotations get modified in a projected volume. */ - It("should update annotations on modification [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should update annotations on modification [sig-storage]", func() { annotations := map[string]string{} annotations["builder"] = "bar" podName := "annotationupdate" + string(uuid.NewUUID()) @@ -1006,7 +1006,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can provide container's CPU limit through DownwardAPIVolumeFiles in a projected volume. */ - It("should provide container's cpu limit [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide container's cpu limit [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/cpu_limit") @@ -1020,7 +1020,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can provide container's memory limit through DownwardAPIVolumeFiles in a projected volume. */ - It("should provide container's memory limit [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide container's memory limit [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/memory_limit") @@ -1034,7 +1034,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can provide container's CPU request through DownwardAPIVolumeFiles in a projected volume. */ - It("should provide container's cpu request [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide container's cpu request [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/cpu_request") @@ -1048,7 +1048,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: Ensure that downward API can provide container's memory request through DownwardAPIVolumeFiles in a projected volume. */ - It("should provide container's memory request [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide container's memory request [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForContainerResources(podName, "/etc/memory_request") @@ -1063,7 +1063,7 @@ var _ = framework.KubeDescribe("Projected", func() { allocatable value for CPU through DownwardAPIVolumeFiles if CPU limit is not specified for a container in a projected volume. */ - It("should provide node allocatable (cpu) as default cpu limit if the limit is not set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide node allocatable (cpu) as default cpu limit if the limit is not set [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForDefaultContainerResources(podName, "/etc/cpu_limit") @@ -1076,7 +1076,7 @@ var _ = framework.KubeDescribe("Projected", func() { allocatable value for memory through DownwardAPIVolumeFiles if memory limit is not specified for a container in a projected volume. */ - It("should provide node allocatable (memory) as default memory limit if the limit is not set [Conformance] [sig-storage]", func() { + framework.ConformanceIt("should provide node allocatable (memory) as default memory limit if the limit is not set [sig-storage]", func() { podName := "downwardapi-volume-" + string(uuid.NewUUID()) pod := downwardAPIVolumeForDefaultContainerResources(podName, "/etc/memory_limit") @@ -1089,7 +1089,7 @@ var _ = framework.KubeDescribe("Projected", func() { Description: This test projects a secret and configmap into the same directory to ensure projection is working as intended. */ - It("should project all components that make up the projection API [Conformance] [sig-storage] [Projection]", func() { + framework.ConformanceIt("should project all components that make up the projection API [sig-storage] [Projection]", func() { var err error podName := "projected-volume-" + string(uuid.NewUUID()) secretName := "secret-projected-all-test-volume-" + string(uuid.NewUUID()) diff --git a/test/e2e/common/secrets.go b/test/e2e/common/secrets.go index 5eb864c9b5c..895e0bcdfae 100644 --- a/test/e2e/common/secrets.go +++ b/test/e2e/common/secrets.go @@ -35,7 +35,7 @@ var _ = Describe("[sig-api-machinery] Secrets", func() { Description: Ensure that secret can be consumed via environment variables. */ - It("should be consumable from pods in env vars [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in env vars ", func() { name := "secret-test-" + string(uuid.NewUUID()) secret := secretForTest(f.Namespace.Name, name) @@ -84,7 +84,7 @@ var _ = Describe("[sig-api-machinery] Secrets", func() { Description: Ensure that secret can be consumed via source of a set of ConfigMaps. */ - It("should be consumable via the environment [Conformance]", func() { + framework.ConformanceIt("should be consumable via the environment ", func() { name := "secret-test-" + string(uuid.NewUUID()) secret := newEnvFromSecret(f.Namespace.Name, name) By(fmt.Sprintf("creating secret %v/%v", f.Namespace.Name, secret.Name)) diff --git a/test/e2e/common/secrets_volume.go b/test/e2e/common/secrets_volume.go index 8ff87fdb8ff..1a37048702a 100644 --- a/test/e2e/common/secrets_volume.go +++ b/test/e2e/common/secrets_volume.go @@ -38,7 +38,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that secret can be mounted without mapping to a pod volume. */ - It("should be consumable from pods in volume [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume ", func() { doSecretE2EWithoutMapping(f, nil /* default mode */, "secret-test-"+string(uuid.NewUUID()), nil, nil) }) @@ -47,7 +47,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that secret can be mounted without mapping to a pod volume in default mode. */ - It("should be consumable from pods in volume with defaultMode set [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with defaultMode set ", func() { defaultMode := int32(0400) doSecretE2EWithoutMapping(f, &defaultMode, "secret-test-"+string(uuid.NewUUID()), nil, nil) }) @@ -57,7 +57,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that secret can be mounted without mapping to a pod volume as non-root in default mode with fsGroup set. */ - It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume as non-root with defaultMode and fsGroup set ", func() { defaultMode := int32(0440) /* setting fsGroup sets mode to at least 440 */ fsGroup := int64(1001) uid := int64(1000) @@ -69,7 +69,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that secret can be mounted with mapping to a pod volume. */ - It("should be consumable from pods in volume with mappings [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings ", func() { doSecretE2EWithMapping(f, nil) }) @@ -78,7 +78,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that secret can be mounted with mapping to a pod volume in item mode. */ - It("should be consumable from pods in volume with mappings and Item Mode set [Conformance]", func() { + framework.ConformanceIt("should be consumable from pods in volume with mappings and Item Mode set ", func() { mode := int32(0400) doSecretE2EWithMapping(f, &mode) }) @@ -108,7 +108,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Testname: secret-multiple-volume-mounts Description: Ensure that secret can be mounted to multiple pod volumes. */ - It("should be consumable in multiple volumes in a pod [Conformance]", func() { + framework.ConformanceIt("should be consumable in multiple volumes in a pod ", func() { // This test ensures that the same secret can be mounted in multiple // volumes in the same pod. This test case exists to prevent // regressions that break this use-case. @@ -186,7 +186,7 @@ var _ = Describe("[sig-storage] Secrets", func() { Description: Ensure that optional update change to secret can be reflected on a mounted volume. */ - It("optional updates should be reflected in volume [Conformance]", func() { + framework.ConformanceIt("optional updates should be reflected in volume ", func() { podLogTimeout := framework.GetPodSecretUpdateTimeout(f.ClientSet) containerTimeoutArg := fmt.Sprintf("--retry_time=%v", int(podLogTimeout.Seconds())) trueVal := true diff --git a/test/e2e/events.go b/test/e2e/events.go index c7b074b3293..40da4bd674d 100644 --- a/test/e2e/events.go +++ b/test/e2e/events.go @@ -36,7 +36,7 @@ import ( var _ = framework.KubeDescribe("Events", func() { f := framework.NewDefaultFramework("events") - It("should be sent by kubelets and the scheduler about pods scheduling and running [Conformance]", func() { + framework.ConformanceIt("should be sent by kubelets and the scheduler about pods scheduling and running ", func() { podClient := f.ClientSet.CoreV1().Pods(f.Namespace.Name) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 57f0588e0b2..2993cd2ba65 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -634,6 +634,11 @@ func KubeDescribe(text string, body func()) bool { return Describe("[k8s.io] "+text, body) } +// Wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier. +func ConformanceIt(text string, body interface{}, timeout ...float64) bool { + return It(text+" [Conformance]", body, timeout...) +} + // PodStateVerification represents a verification of pod state. // Any time you have a set of pods that you want to operate against or query, // this struct can be used to declaratively identify those pods. diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index f62b5b17da6..d9d0646a85d 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -305,7 +305,7 @@ var _ = SIGDescribe("Kubectl client", func() { nautilus = substituteImageName(string(generated.ReadOrDie(filepath.Join(updateDemoRoot, "nautilus-rc.yaml.in")))) kitten = substituteImageName(string(generated.ReadOrDie(filepath.Join(updateDemoRoot, "kitten-rc.yaml.in")))) }) - It("should create and stop a replication controller [Conformance]", func() { + framework.ConformanceIt("should create and stop a replication controller ", func() { defer cleanupKubectlInputs(nautilus, ns, updateDemoSelector) By("creating a replication controller") @@ -313,7 +313,7 @@ var _ = SIGDescribe("Kubectl client", func() { framework.ValidateController(c, nautilusImage, 2, "update-demo", updateDemoSelector, getUDData("nautilus.jpg", ns), ns) }) - It("should scale a replication controller [Conformance]", func() { + framework.ConformanceIt("should scale a replication controller ", func() { defer cleanupKubectlInputs(nautilus, ns, updateDemoSelector) By("creating a replication controller") @@ -327,7 +327,7 @@ var _ = SIGDescribe("Kubectl client", func() { framework.ValidateController(c, nautilusImage, 2, "update-demo", updateDemoSelector, getUDData("nautilus.jpg", ns), ns) }) - It("should do a rolling update of a replication controller [Conformance]", func() { + framework.ConformanceIt("should do a rolling update of a replication controller ", func() { By("creating the initial replication controller") framework.RunKubectlOrDieInput(string(nautilus[:]), "create", "-f", "-", fmt.Sprintf("--namespace=%v", ns)) framework.ValidateController(c, nautilusImage, 2, "update-demo", updateDemoSelector, getUDData("nautilus.jpg", ns), ns) @@ -354,7 +354,7 @@ var _ = SIGDescribe("Kubectl client", func() { } } - It("should create and stop a working application [Conformance]", func() { + framework.ConformanceIt("should create and stop a working application ", func() { framework.SkipUnlessServerVersionGTE(deploymentsVersion, c.Discovery()) defer forEachGBFile(func(contents string) { @@ -722,7 +722,7 @@ metadata: }) framework.KubeDescribe("Kubectl api-versions", func() { - It("should check if v1 is in available api versions [Conformance]", func() { + framework.ConformanceIt("should check if v1 is in available api versions ", func() { By("validating api versions") output := framework.RunKubectlOrDie("api-versions") if !strings.Contains(output, "v1") { @@ -813,7 +813,7 @@ metadata: }) framework.KubeDescribe("Kubectl cluster-info", func() { - It("should check if Kubernetes master services is included in cluster-info [Conformance]", func() { + framework.ConformanceIt("should check if Kubernetes master services is included in cluster-info ", func() { By("validating cluster-info") output := framework.RunKubectlOrDie("cluster-info") // Can't check exact strings due to terminal control commands (colors) @@ -830,7 +830,7 @@ metadata: }) framework.KubeDescribe("Kubectl describe", func() { - It("should check if kubectl describe prints relevant information for rc and pods [Conformance]", func() { + framework.ConformanceIt("should check if kubectl describe prints relevant information for rc and pods ", func() { framework.SkipUnlessServerVersionGTE(nodePortsOptionalVersion, c.Discovery()) kv, err := framework.KubectlVersion() Expect(err).NotTo(HaveOccurred()) @@ -935,7 +935,7 @@ metadata: }) framework.KubeDescribe("Kubectl expose", func() { - It("should create services for rc [Conformance]", func() { + framework.ConformanceIt("should create services for rc ", func() { controllerJson := substituteImageName(string(readTestFileOrDie(redisControllerFilename))) nsFlag := fmt.Sprintf("--namespace=%v", ns) @@ -1026,7 +1026,7 @@ metadata: cleanupKubectlInputs(podYaml, ns, pausePodSelector) }) - It("should update the label on a resource [Conformance]", func() { + framework.ConformanceIt("should update the label on a resource ", func() { labelName := "testing-label" labelValue := "testing-label-value" @@ -1061,7 +1061,7 @@ metadata: cleanupKubectlInputs(rc, ns, simplePodSelector) }) - It("should be able to retrieve and filter logs [Conformance]", func() { + framework.ConformanceIt("should be able to retrieve and filter logs ", func() { framework.SkipUnlessServerVersionGTE(extendedPodLogFilterVersion, c.Discovery()) // Split("something\n", "\n") returns ["something", ""], so @@ -1114,7 +1114,7 @@ metadata: }) framework.KubeDescribe("Kubectl patch", func() { - It("should add annotations for pods in rc [Conformance]", func() { + framework.ConformanceIt("should add annotations for pods in rc ", func() { controllerJson := substituteImageName(string(readTestFileOrDie(redisControllerFilename))) nsFlag := fmt.Sprintf("--namespace=%v", ns) By("creating Redis RC") @@ -1143,7 +1143,7 @@ metadata: }) framework.KubeDescribe("Kubectl version", func() { - It("should check is all data is printed [Conformance]", func() { + framework.ConformanceIt("should check is all data is printed ", func() { version := framework.RunKubectlOrDie("version") requiredItems := []string{"Client Version:", "Server Version:", "Major:", "Minor:", "GitCommit:"} for _, item := range requiredItems { @@ -1179,7 +1179,7 @@ metadata: cleanUp() }) - It("should create an rc or deployment from an image [Conformance]", func() { + framework.ConformanceIt("should create an rc or deployment from an image ", func() { By("running the image " + nginxImage) framework.RunKubectlOrDie("run", name, "--image="+nginxImage, nsFlag) By("verifying the pod controlled by " + name + " gets created") @@ -1209,7 +1209,7 @@ metadata: framework.RunKubectlOrDie("delete", "rc", rcName, nsFlag) }) - It("should create an rc from an image [Conformance]", func() { + framework.ConformanceIt("should create an rc from an image ", func() { By("running the image " + nginxImage) framework.RunKubectlOrDie("run", rcName, "--image="+nginxImage, "--generator=run/v1", nsFlag) By("verifying the rc " + rcName + " was created") @@ -1265,7 +1265,7 @@ metadata: framework.RunKubectlOrDie("delete", "rc", rcName, nsFlag) }) - It("should support rolling-update to same image [Conformance]", func() { + framework.ConformanceIt("should support rolling-update to same image ", func() { By("running the image " + nginxImage) framework.RunKubectlOrDie("run", rcName, "--image="+nginxImage, "--generator=run/v1", nsFlag) By("verifying the rc " + rcName + " was created") @@ -1309,7 +1309,7 @@ metadata: Expect(err).NotTo(HaveOccurred()) }) - It("should create a deployment from an image [Conformance]", func() { + framework.ConformanceIt("should create a deployment from an image ", func() { framework.SkipUnlessServerVersionGTE(deploymentsVersion, c.Discovery()) By("running the image " + nginxImage) @@ -1351,7 +1351,7 @@ metadata: framework.RunKubectlOrDie("delete", "jobs", jobName, nsFlag) }) - It("should create a job from an image when restart is OnFailure [Conformance]", func() { + framework.ConformanceIt("should create a job from an image when restart is OnFailure ", func() { framework.SkipUnlessServerVersionGTE(jobsVersion, c.Discovery()) By("running the image " + nginxImage) @@ -1421,7 +1421,7 @@ metadata: framework.RunKubectlOrDie("delete", "pods", podName, nsFlag) }) - It("should create a pod from an image when restart is Never [Conformance]", func() { + framework.ConformanceIt("should create a pod from an image when restart is Never ", func() { framework.SkipUnlessServerVersionGTE(jobsVersion, c.Discovery()) By("running the image " + nginxImage) @@ -1454,7 +1454,7 @@ metadata: framework.RunKubectlOrDie("delete", "pods", podName, nsFlag) }) - It("should update a single-container pod's image [Conformance]", func() { + framework.ConformanceIt("should update a single-container pod's image ", func() { framework.SkipUnlessServerVersionGTE(jobsVersion, c.Discovery()) By("running the image " + nginxImage) @@ -1492,7 +1492,7 @@ metadata: framework.KubeDescribe("Kubectl run --rm job", func() { jobName := "e2e-test-rm-busybox-job" - It("should create a job from an image, then delete the job [Conformance]", func() { + framework.ConformanceIt("should create a job from an image, then delete the job ", func() { nsFlag := fmt.Sprintf("--namespace=%v", ns) // The rkt runtime doesn't support attach, see #23335 @@ -1518,7 +1518,7 @@ metadata: framework.KubeDescribe("Proxy server", func() { // TODO: test proxy options (static, prefix, etc) - It("should support proxy with --port 0 [Conformance]", func() { + framework.ConformanceIt("should support proxy with --port 0 ", func() { By("starting the proxy server") port, cmd, err := startProxyServer() if cmd != nil { @@ -1538,7 +1538,7 @@ metadata: } }) - It("should support --unix-socket=/path [Conformance]", func() { + framework.ConformanceIt("should support --unix-socket=/path ", func() { By("Starting the proxy") tmpdir, err := ioutil.TempDir("", "kubectl-proxy-unix") if err != nil { diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index edb73262a7f..5bf286b972c 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -284,7 +284,7 @@ func reverseArray(arr []string) []string { var _ = SIGDescribe("DNS", func() { f := framework.NewDefaultFramework("dns") - It("should provide DNS for the cluster [Conformance]", func() { + framework.ConformanceIt("should provide DNS for the cluster ", func() { // All the names we need to be able to resolve. // TODO: Spin up a separate test service and test that dns works for that service. namesToResolve := []string{ @@ -310,7 +310,7 @@ var _ = SIGDescribe("DNS", func() { validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...)) }) - It("should provide DNS for services [Conformance]", func() { + framework.ConformanceIt("should provide DNS for services ", func() { // Create a test headless service. By("Creating a test headless service") testServiceSelector := map[string]string{ diff --git a/test/e2e/network/proxy.go b/test/e2e/network/proxy.go index 37a9b816b26..863bfdabf6d 100644 --- a/test/e2e/network/proxy.go +++ b/test/e2e/network/proxy.go @@ -67,14 +67,14 @@ var _ = SIGDescribe("Proxy", func() { Description: Ensure that proxy on node logs works with generic top level prefix proxy and explicit kubelet port. */ - It("should proxy logs on node with explicit kubelet port [Conformance]", func() { nodeProxyTest(f, prefix+"/proxy/nodes/", ":10250/logs/") }) + framework.ConformanceIt("should proxy logs on node with explicit kubelet port ", func() { nodeProxyTest(f, prefix+"/proxy/nodes/", ":10250/logs/") }) /* Testname: proxy-prefix-node-logs Description: Ensure that proxy on node logs works with generic top level prefix proxy. */ - It("should proxy logs on node [Conformance]", func() { nodeProxyTest(f, prefix+"/proxy/nodes/", "/logs/") }) + framework.ConformanceIt("should proxy logs on node ", func() { nodeProxyTest(f, prefix+"/proxy/nodes/", "/logs/") }) It("should proxy to cadvisor", func() { nodeProxyTest(f, prefix+"/proxy/nodes/", ":4194/containers/") }) /* @@ -82,14 +82,14 @@ var _ = SIGDescribe("Proxy", func() { Description: Ensure that proxy on node logs works with node proxy subresource and explicit kubelet port. */ - It("should proxy logs on node with explicit kubelet port using proxy subresource [Conformance]", func() { nodeProxyTest(f, prefix+"/nodes/", ":10250/proxy/logs/") }) + framework.ConformanceIt("should proxy logs on node with explicit kubelet port using proxy subresource ", func() { nodeProxyTest(f, prefix+"/nodes/", ":10250/proxy/logs/") }) /* Testname: proxy-subresource-node-logs Description: Ensure that proxy on node logs works with node proxy subresource. */ - It("should proxy logs on node using proxy subresource [Conformance]", func() { nodeProxyTest(f, prefix+"/nodes/", "/proxy/logs/") }) + framework.ConformanceIt("should proxy logs on node using proxy subresource ", func() { nodeProxyTest(f, prefix+"/nodes/", "/proxy/logs/") }) It("should proxy to cadvisor using proxy subresource", func() { nodeProxyTest(f, prefix+"/nodes/", ":4194/proxy/containers/") }) // using the porter image to serve content, access the content @@ -100,7 +100,7 @@ var _ = SIGDescribe("Proxy", func() { Description: Ensure that proxy through a service and a pod works with both generic top level prefix proxy and proxy subresource. */ - It("should proxy through a service and a pod [Conformance]", func() { + framework.ConformanceIt("should proxy through a service and a pod ", func() { start := time.Now() labels := map[string]string{"proxy-service-target": "true"} service, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Create(&v1.Service{ diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 5d04e07b66f..a9fb74fc423 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -69,7 +69,7 @@ var _ = SIGDescribe("Services", func() { Testname: service-kubernetes-exists Description: Make sure kubernetes service does exist. */ - It("should provide secure master service [Conformance]", func() { + framework.ConformanceIt("should provide secure master service ", func() { _, err := cs.CoreV1().Services(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{}) Expect(err).NotTo(HaveOccurred()) }) @@ -79,7 +79,7 @@ var _ = SIGDescribe("Services", func() { Description: Ensure a service with no pod, one pod or two pods has valid/accessible endpoints (same port number for service and pods). */ - It("should serve a basic endpoint from pods [Conformance]", func() { + framework.ConformanceIt("should serve a basic endpoint from pods ", func() { // TODO: use the ServiceTestJig here serviceName := "endpoint-test2" ns := f.Namespace.Name @@ -144,7 +144,7 @@ var _ = SIGDescribe("Services", func() { Description: Ensure a service with no pod, one pod or two pods has valid/accessible endpoints (different port number for pods). */ - It("should serve multiport endpoints from pods [Conformance]", func() { + framework.ConformanceIt("should serve multiport endpoints from pods ", func() { // TODO: use the ServiceTestJig here // repacking functionality is intentionally not tested here - it's better to test it in an integration test. serviceName := "multi-endpoint-test" diff --git a/test/e2e/network/service_latency.go b/test/e2e/network/service_latency.go index 0961d95971f..136c178d6d5 100644 --- a/test/e2e/network/service_latency.go +++ b/test/e2e/network/service_latency.go @@ -51,7 +51,7 @@ var _ = SIGDescribe("Service endpoints latency", func() { (e.g. p50 < 20 seconds and p99 < 50 seconds). If any call to the service endpoint fails, the test will also fail. */ - It("should not be very high [Conformance]", func() { + framework.ConformanceIt("should not be very high ", func() { const ( // These are very generous criteria. Ideally we will // get this much lower in the future. See issue diff --git a/test/e2e/pods.go b/test/e2e/pods.go index 79da117c7c7..fbe39de7dd6 100644 --- a/test/e2e/pods.go +++ b/test/e2e/pods.go @@ -47,7 +47,7 @@ var _ = framework.KubeDescribe("Pods Extended", func() { podClient = f.PodClient() }) // Flaky issue #36821. - It("should be submitted and removed [Conformance] [Flaky]", func() { + framework.ConformanceIt("should be submitted and removed [Flaky]", func() { By("creating the pod") name := "pod-submit-remove-" + string(uuid.NewUUID()) value := strconv.Itoa(time.Now().Nanosecond()) @@ -199,7 +199,7 @@ var _ = framework.KubeDescribe("Pods Extended", func() { BeforeEach(func() { podClient = f.PodClient() }) - It("should be submitted and removed [Conformance]", func() { + framework.ConformanceIt("should be submitted and removed ", func() { By("creating the pod") name := "pod-qos-class-" + string(uuid.NewUUID()) pod := &v1.Pod{ diff --git a/test/e2e/pre_stop.go b/test/e2e/pre_stop.go index 6b14d372e13..ac7e25a0bbd 100644 --- a/test/e2e/pre_stop.go +++ b/test/e2e/pre_stop.go @@ -180,7 +180,7 @@ var _ = framework.KubeDescribe("PreStop", func() { Description: Makes sure a pod's preStop handler is successfully invoked immediately before a container is terminated. */ - It("should call prestop when killing a pod [Conformance]", func() { + framework.ConformanceIt("should call prestop when killing a pod ", func() { testPreStop(f.ClientSet, f.Namespace.Name) }) }) diff --git a/test/e2e/scheduling/predicates.go b/test/e2e/scheduling/predicates.go index 5f229fe0dec..3c32b9fffde 100644 --- a/test/e2e/scheduling/predicates.go +++ b/test/e2e/scheduling/predicates.go @@ -242,7 +242,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() { Description: Ensure that scheduler accounts node resources correctly and respects pods' resource requirements during scheduling. */ - It("validates resource limits of pods that are allowed to run [Conformance]", func() { + framework.ConformanceIt("validates resource limits of pods that are allowed to run ", func() { framework.WaitForStableCluster(cs, masterNodes) nodeMaxAllocatable := int64(0) nodeToAllocatableMap := make(map[string]int64) @@ -348,7 +348,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() { Description: Ensure that scheduler respects the NodeSelector field of PodSpec during scheduling (when it does not match any node). */ - It("validates that NodeSelector is respected if not matching [Conformance]", func() { + framework.ConformanceIt("validates that NodeSelector is respected if not matching ", func() { By("Trying to schedule Pod with nonempty NodeSelector.") podName := "restricted-pod" @@ -394,7 +394,7 @@ var _ = SIGDescribe("SchedulerPredicates [Serial]", func() { Description: Ensure that scheduler respects the NodeSelector field of PodSpec during scheduling (when it matches). */ - It("validates that NodeSelector is respected if matching [Conformance]", func() { + framework.ConformanceIt("validates that NodeSelector is respected if matching ", func() { nodeName := GetNodeThatCanRunPod(f) By("Trying to apply a random label on the found node.") From fad431118a0ddbb0d291fa31b24a70e13357cd31 Mon Sep 17 00:00:00 2001 From: Matt Liggett Date: Tue, 10 Oct 2017 14:34:48 -0700 Subject: [PATCH 2/3] Add conformance test regression test. This test creates a golden list of existing conformance tests. Efforts to add or remove conformance tests will require you to rebuild the golden list, and changes to the golden list will be reviewed by sig-architecture. --- test/BUILD | 1 + test/conformance/BUILD | 42 ++++++ test/conformance/OWNERS | 7 + test/conformance/conformance_test.sh | 25 ++++ test/conformance/testdata/OWNERS | 9 ++ test/conformance/testdata/conformance.txt | 150 +++++++++++++++++++ test/conformance/walk.go | 166 ++++++++++++++++++++++ 7 files changed, 400 insertions(+) create mode 100644 test/conformance/BUILD create mode 100644 test/conformance/OWNERS create mode 100755 test/conformance/conformance_test.sh create mode 100644 test/conformance/testdata/OWNERS create mode 100755 test/conformance/testdata/conformance.txt create mode 100644 test/conformance/walk.go diff --git a/test/BUILD b/test/BUILD index 831bcb91f16..aa84e470655 100644 --- a/test/BUILD +++ b/test/BUILD @@ -11,6 +11,7 @@ filegroup( name = "all-srcs", srcs = [ ":package-srcs", + "//test/conformance:all-srcs", "//test/e2e:all-srcs", "//test/e2e_node:all-srcs", "//test/fixtures:all-srcs", diff --git a/test/conformance/BUILD b/test/conformance/BUILD new file mode 100644 index 00000000000..27bbed81564 --- /dev/null +++ b/test/conformance/BUILD @@ -0,0 +1,42 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["walk.go"], + visibility = ["//visibility:private"], +) + +go_binary( + name = "conformance", + library = ":go_default_library", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) + +genrule( + name = "list_conformance_tests", + srcs = ["//test/e2e:all-srcs"], + outs = ["conformance.txt"], + cmd = "./$(location :conformance) $(locations //test/e2e:all-srcs) > $@", + message = "Listing all conformance tests.", + tools = [":conformance"], +) + +sh_test( + name = "conformance_test", + srcs = ["conformance_test.sh"], + data = ["testdata/conformance.txt", ":list_conformance_tests"], +) diff --git a/test/conformance/OWNERS b/test/conformance/OWNERS new file mode 100644 index 00000000000..155eb146fb4 --- /dev/null +++ b/test/conformance/OWNERS @@ -0,0 +1,7 @@ +# This is the owner of the test code. The test data itself is owned by sig-architecture. +reviewers: + - mml + - cheftako +approvers: + - mml + - cheftako diff --git a/test/conformance/conformance_test.sh b/test/conformance/conformance_test.sh new file mode 100755 index 00000000000..b0e5eb1cd86 --- /dev/null +++ b/test/conformance/conformance_test.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# echo ${TEST_SRCDIR} +# pwd +# env | grep --color=always test/conformance +# find ${TEST_SRCDIR} -ls | grep --color=always test/conformance + +set -o errexit + +diff -u test/conformance/testdata/conformance.txt test/conformance/conformance.txt +echo PASS diff --git a/test/conformance/testdata/OWNERS b/test/conformance/testdata/OWNERS new file mode 100644 index 00000000000..ff12a8f5450 --- /dev/null +++ b/test/conformance/testdata/OWNERS @@ -0,0 +1,9 @@ +# To be owned by sig-architecture. +# TODO(mml): Exclude parent owners once +# https://github.com/kubernetes/test-infra/issues/5197 is implemented. +reviewers: + - bgrant0607 + - smarterclayton +approvers: + - bgrant0607 + - smarterclayton diff --git a/test/conformance/testdata/conformance.txt b/test/conformance/testdata/conformance.txt new file mode 100755 index 00000000000..55811df5666 --- /dev/null +++ b/test/conformance/testdata/conformance.txt @@ -0,0 +1,150 @@ +test/e2e/apimachinery/custom_resource_definition.go: "creating/deleting custom resource definition objects works " +test/e2e/apps/rc.go: "should serve a basic image on each replica with a public image " +test/e2e/apps/replica_set.go: "should serve a basic image on each replica with a public image " +test/e2e/auth/service_accounts.go: "should mount an API token into pods " +test/e2e/auth/service_accounts.go: "should allow opting out of API token automount " +test/e2e/common/configmap.go: "should be consumable via environment variable " +test/e2e/common/configmap.go: "should be consumable via the environment " +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume " +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with defaultMode set " +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume as non-root " +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings " +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings and Item mode set" +test/e2e/common/configmap_volume.go: "should be consumable from pods in volume with mappings as non-root " +test/e2e/common/configmap_volume.go: "updates should be reflected in volume " +test/e2e/common/configmap_volume.go: "optional updates should be reflected in volume " +test/e2e/common/configmap_volume.go: "should be consumable in multiple volumes in the same pod " +test/e2e/common/container_probe.go: "with readiness probe should not be ready before initial delay and never restart " +test/e2e/common/container_probe.go: "with readiness probe that fails should never be ready and never restart " +test/e2e/common/container_probe.go: "should be restarted with a exec \"cat /tmp/health\" liveness probe" +test/e2e/common/container_probe.go: "should *not* be restarted with a exec \"cat /tmp/health\" liveness probe" +test/e2e/common/container_probe.go: "should be restarted with a /healthz http liveness probe " +test/e2e/common/container_probe.go: "should have monotonically increasing restart count [Slow]" +test/e2e/common/container_probe.go: "should *not* be restarted with a /healthz http liveness probe " +test/e2e/common/container_probe.go: "should be restarted with a docker exec liveness probe with timeout " +test/e2e/common/docker_containers.go: "should use the image defaults if command and args are blank " +test/e2e/common/docker_containers.go: "should be able to override the image's default arguments (docker cmd) " +test/e2e/common/docker_containers.go: "should be able to override the image's default commmand (docker entrypoint) " +test/e2e/common/docker_containers.go: "should be able to override the image's default command and arguments " +test/e2e/common/downward_api.go: "should provide pod name and namespace as env vars " +test/e2e/common/downward_api.go: "should provide pod IP as an env var " +test/e2e/common/downward_api.go: "should provide host IP as an env var " +test/e2e/common/downward_api.go: "should provide container's limits.cpu/memory and requests.cpu/memory as env vars " +test/e2e/common/downward_api.go: "should provide default limits.cpu/memory from node allocatable " +test/e2e/common/downward_api.go: "should provide pod UID as env vars " +test/e2e/common/downwardapi_volume.go: "should provide podname only " +test/e2e/common/downwardapi_volume.go: "should set DefaultMode on files " +test/e2e/common/downwardapi_volume.go: "should set mode on item file " +test/e2e/common/downwardapi_volume.go: "should update labels on modification " +test/e2e/common/downwardapi_volume.go: "should update annotations on modification " +test/e2e/common/downwardapi_volume.go: "should provide container's cpu limit " +test/e2e/common/downwardapi_volume.go: "should provide container's memory limit " +test/e2e/common/downwardapi_volume.go: "should provide container's cpu request " +test/e2e/common/downwardapi_volume.go: "should provide container's memory request " +test/e2e/common/downwardapi_volume.go: "should provide node allocatable (cpu) as default cpu limit if the limit is not set " +test/e2e/common/downwardapi_volume.go: "should provide node allocatable (memory) as default memory limit if the limit is not set " +test/e2e/common/empty_dir.go: "volume on tmpfs should have the correct mode [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0644,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0666,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0777,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0644,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0666,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0777,tmpfs) [sig-storage]" +test/e2e/common/empty_dir.go: "volume on default medium should have the correct mode [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0644,default) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0666,default) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (root,0777,default) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0644,default) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0666,default) [sig-storage]" +test/e2e/common/empty_dir.go: "should support (non-root,0777,default) [sig-storage]" +test/e2e/common/expansion.go: "should allow composing env vars into new env vars " +test/e2e/common/expansion.go: "should allow substituting values in a container's command " +test/e2e/common/expansion.go: "should allow substituting values in a container's args " +test/e2e/common/host_path.go: "should give a volume the correct mode [sig-storage]" +test/e2e/common/kubelet_etc_hosts.go: "should test kubelet managed /etc/hosts file " +test/e2e/common/networking.go: "should function for intra-pod communication: http " +test/e2e/common/networking.go: "should function for intra-pod communication: udp " +test/e2e/common/networking.go: "should function for node-pod communication: http " +test/e2e/common/networking.go: "should function for node-pod communication: udp " +test/e2e/common/pods.go: "should get a host IP " +test/e2e/common/pods.go: "should be submitted and removed " +test/e2e/common/pods.go: "should be updated " +test/e2e/common/pods.go: "should allow activeDeadlineSeconds to be updated " +test/e2e/common/pods.go: "should contain environment variables for services " +test/e2e/common/projected.go: "should be consumable from pods in volume [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with defaultMode set [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume as non-root with defaultMode and fsGroup set [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with mappings [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with mappings and Item Mode set [sig-storage]" +test/e2e/common/projected.go: "should be consumable in multiple volumes in a pod [sig-storage]" +test/e2e/common/projected.go: "optional updates should be reflected in volume [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with defaultMode set [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume as non-root [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with mappings [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with mappings and Item mode set [sig-storage]" +test/e2e/common/projected.go: "should be consumable from pods in volume with mappings as non-root [sig-storage]" +test/e2e/common/projected.go: "updates should be reflected in volume [sig-storage]" +test/e2e/common/projected.go: "optional updates should be reflected in volume [sig-storage]" +test/e2e/common/projected.go: "should be consumable in multiple volumes in the same pod [sig-storage]" +test/e2e/common/projected.go: "should provide podname only [sig-storage]" +test/e2e/common/projected.go: "should set DefaultMode on files [sig-storage]" +test/e2e/common/projected.go: "should set mode on item file [sig-storage]" +test/e2e/common/projected.go: "should update labels on modification [sig-storage]" +test/e2e/common/projected.go: "should update annotations on modification [sig-storage]" +test/e2e/common/projected.go: "should provide container's cpu limit [sig-storage]" +test/e2e/common/projected.go: "should provide container's memory limit [sig-storage]" +test/e2e/common/projected.go: "should provide container's cpu request [sig-storage]" +test/e2e/common/projected.go: "should provide container's memory request [sig-storage]" +test/e2e/common/projected.go: "should provide node allocatable (cpu) as default cpu limit if the limit is not set [sig-storage]" +test/e2e/common/projected.go: "should provide node allocatable (memory) as default memory limit if the limit is not set [sig-storage]" +test/e2e/common/projected.go: "should project all components that make up the projection API [sig-storage] [Projection]" +test/e2e/common/secrets.go: "should be consumable from pods in env vars " +test/e2e/common/secrets.go: "should be consumable via the environment " +test/e2e/common/secrets_volume.go: "should be consumable from pods in volume " +test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with defaultMode set " +test/e2e/common/secrets_volume.go: "should be consumable from pods in volume as non-root with defaultMode and fsGroup set " +test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with mappings " +test/e2e/common/secrets_volume.go: "should be consumable from pods in volume with mappings and Item Mode set " +test/e2e/common/secrets_volume.go: "should be consumable in multiple volumes in a pod " +test/e2e/common/secrets_volume.go: "optional updates should be reflected in volume " +test/e2e/events.go: "should be sent by kubelets and the scheduler about pods scheduling and running " +test/e2e/kubectl/kubectl.go: "should create and stop a replication controller " +test/e2e/kubectl/kubectl.go: "should scale a replication controller " +test/e2e/kubectl/kubectl.go: "should do a rolling update of a replication controller " +test/e2e/kubectl/kubectl.go: "should create and stop a working application " +test/e2e/kubectl/kubectl.go: "should check if v1 is in available api versions " +test/e2e/kubectl/kubectl.go: "should check if Kubernetes master services is included in cluster-info " +test/e2e/kubectl/kubectl.go: "should check if kubectl describe prints relevant information for rc and pods " +test/e2e/kubectl/kubectl.go: "should create services for rc " +test/e2e/kubectl/kubectl.go: "should update the label on a resource " +test/e2e/kubectl/kubectl.go: "should be able to retrieve and filter logs " +test/e2e/kubectl/kubectl.go: "should add annotations for pods in rc " +test/e2e/kubectl/kubectl.go: "should check is all data is printed " +test/e2e/kubectl/kubectl.go: "should create an rc or deployment from an image " +test/e2e/kubectl/kubectl.go: "should create an rc from an image " +test/e2e/kubectl/kubectl.go: "should support rolling-update to same image " +test/e2e/kubectl/kubectl.go: "should create a deployment from an image " +test/e2e/kubectl/kubectl.go: "should create a job from an image when restart is OnFailure " +test/e2e/kubectl/kubectl.go: "should create a pod from an image when restart is Never " +test/e2e/kubectl/kubectl.go: "should update a single-container pod's image " +test/e2e/kubectl/kubectl.go: "should create a job from an image, then delete the job " +test/e2e/kubectl/kubectl.go: "should support proxy with --port 0 " +test/e2e/kubectl/kubectl.go: "should support --unix-socket=/path " +test/e2e/network/dns.go: "should provide DNS for the cluster " +test/e2e/network/dns.go: "should provide DNS for services " +test/e2e/network/proxy.go: "should proxy logs on node with explicit kubelet port " +test/e2e/network/proxy.go: "should proxy logs on node " +test/e2e/network/proxy.go: "should proxy logs on node with explicit kubelet port using proxy subresource " +test/e2e/network/proxy.go: "should proxy logs on node using proxy subresource " +test/e2e/network/proxy.go: "should proxy through a service and a pod " +test/e2e/network/service.go: "should provide secure master service " +test/e2e/network/service.go: "should serve a basic endpoint from pods " +test/e2e/network/service.go: "should serve multiport endpoints from pods " +test/e2e/network/service_latency.go: "should not be very high " +test/e2e/pods.go: "should be submitted and removed [Flaky]" +test/e2e/pods.go: "should be submitted and removed " +test/e2e/pre_stop.go: "should call prestop when killing a pod " +test/e2e/scheduling/predicates.go: "validates resource limits of pods that are allowed to run " +test/e2e/scheduling/predicates.go: "validates that NodeSelector is respected if not matching " +test/e2e/scheduling/predicates.go: "validates that NodeSelector is respected if matching " diff --git a/test/conformance/walk.go b/test/conformance/walk.go new file mode 100644 index 00000000000..9637620f182 --- /dev/null +++ b/test/conformance/walk.go @@ -0,0 +1,166 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package main provides a tool that scans kubernetes e2e test source code +// looking for conformance test declarations, which it emits on stdout. It +// also looks for legacy, manually added "[Conformance]" tags and reports an +// error if it finds any. +// +// This approach is not air tight, but it will serve our purpose as a +// pre-submit check. +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "os" + "path/filepath" + "strings" +) + +type visitor struct { + FileSet *token.FileSet +} + +func newVisitor() *visitor { + return &visitor{ + FileSet: token.NewFileSet(), + } +} + +func (v *visitor) isConformanceCall(call *ast.CallExpr) bool { + switch fun := call.Fun.(type) { + case *ast.SelectorExpr: + if fun.Sel != nil { + return fun.Sel.Name == "ConformanceIt" + } + } + return false +} + +func (v *visitor) isLegacyItCall(call *ast.CallExpr) bool { + switch fun := call.Fun.(type) { + case *ast.Ident: + if fun.Name != "It" { + return false + } + if len(call.Args) < 1 { + v.failf(call, "Not enough arguments to It()") + } + default: + return false + } + + switch arg := call.Args[0].(type) { + case *ast.BasicLit: + if arg.Kind != token.STRING { + v.failf(arg, "Unexpected non-string argument to It()") + } + if strings.Contains(arg.Value, "[Conformance]") { + return true + } + default: + // non-literal argument to It()... we just ignore these even though they could be a way to "sneak in" a conformance test + } + + return false +} + +func (v *visitor) failf(expr ast.Expr, format string, a ...interface{}) { + msg := fmt.Sprintf(format, a...) + fmt.Fprintf(os.Stderr, "ERROR at %v: %s\n", v.FileSet.Position(expr.Pos()), msg) + os.Exit(65) +} + +func (v *visitor) emit(arg ast.Expr) { + switch at := arg.(type) { + case *ast.BasicLit: + if at.Kind != token.STRING { + v.failf(at, "framework.ConformanceIt() called with non-string argument") + return + } + fmt.Printf("%s: %s\n", v.FileSet.Position(at.Pos()).Filename, at.Value) + default: + v.failf(at, "framework.ConformanceIt() called with non-literal argument") + fmt.Fprintf(os.Stderr, "ERROR: non-literal argument %v at %v\n", arg, v.FileSet.Position(arg.Pos())) + } +} + +// Visit visits each node looking for either calls to framework.ConformanceIt, +// which it will emit in its list of conformance tests, or legacy calls to +// It() with a manually embedded [Conformance] tag, which it will complain +// about. +func (v *visitor) Visit(node ast.Node) (w ast.Visitor) { + switch t := node.(type) { + case *ast.CallExpr: + if v.isConformanceCall(t) { + v.emit(t.Args[0]) + } else if v.isLegacyItCall(t) { + v.failf(t, "Using It() with manual [Conformance] tag is no longer allowed. Use framework.ConformanceIt() instead.") + return nil + } + } + return v +} + +func scandir(dir string) { + v := newVisitor() + pkg, err := parser.ParseDir(v.FileSet, dir, nil, 0) + if err != nil { + panic(err) + } + + for _, p := range pkg { + ast.Walk(v, p) + } +} + +func scanfile(path string) { + v := newVisitor() + file, err := parser.ParseFile(v.FileSet, path, nil, 0) + if err != nil { + panic(err) + } + + ast.Walk(v, file) +} + +func main() { + args := os.Args[1:] + if len(args) < 1 { + fmt.Fprintf(os.Stderr, "USAGE: %s [...]\n", os.Args[0]) + os.Exit(64) + } + + for _, arg := range args { + filepath.Walk(arg, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + scandir(path) + } else { + // TODO(mml): Remove this once we have all-go-srcs build rules. See https://github.com/kubernetes/repo-infra/pull/45 + if strings.HasSuffix(path, ".go") { + scanfile(path) + } + } + return nil + }) + } +} From 6096d9d4a187e422ed5fc53d0c8314b86252c0ce Mon Sep 17 00:00:00 2001 From: Matt Liggett Date: Fri, 27 Oct 2017 14:12:05 -0700 Subject: [PATCH 3/3] update-bazel --- test/conformance/BUILD | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/conformance/BUILD b/test/conformance/BUILD index 27bbed81564..7c11b84663c 100644 --- a/test/conformance/BUILD +++ b/test/conformance/BUILD @@ -3,11 +3,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( name = "go_default_library", srcs = ["walk.go"], + importpath = "k8s.io/kubernetes/test/conformance", visibility = ["//visibility:private"], ) go_binary( name = "conformance", + importpath = "k8s.io/kubernetes/test/conformance", library = ":go_default_library", visibility = ["//visibility:public"], ) @@ -38,5 +40,8 @@ genrule( sh_test( name = "conformance_test", srcs = ["conformance_test.sh"], - data = ["testdata/conformance.txt", ":list_conformance_tests"], + data = [ + "testdata/conformance.txt", + ":list_conformance_tests", + ], )