Merge pull request #78283 from s-ito-ts/77706_e2e_common
Use framework.ExpectError() for e2e/common
This commit is contained in:
		| @@ -26,7 +26,6 @@ import ( | |||||||
| 	imageutils "k8s.io/kubernetes/test/utils/image" | 	imageutils "k8s.io/kubernetes/test/utils/image" | ||||||
|  |  | ||||||
| 	. "github.com/onsi/ginkgo" | 	. "github.com/onsi/ginkgo" | ||||||
| 	. "github.com/onsi/gomega" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ = Describe("[sig-node] ConfigMap", func() { | var _ = Describe("[sig-node] ConfigMap", func() { | ||||||
| @@ -132,7 +131,7 @@ var _ = Describe("[sig-node] ConfigMap", func() { | |||||||
| 	*/ | 	*/ | ||||||
| 	framework.ConformanceIt("should fail to create ConfigMap with empty key", func() { | 	framework.ConformanceIt("should fail to create ConfigMap with empty key", func() { | ||||||
| 		configMap, err := newConfigMapWithEmptyKey(f) | 		configMap, err := newConfigMapWithEmptyKey(f) | ||||||
| 		Expect(err).To(HaveOccurred(), "created configMap %q with empty key in namespace %q", configMap.Name, f.Namespace.Name) | 		framework.ExpectError(err, "created configMap %q with empty key in namespace %q", configMap.Name, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -551,7 +551,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { | |||||||
| 		volumeMountPath := "/etc/configmap-volumes" | 		volumeMountPath := "/etc/configmap-volumes" | ||||||
| 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalConfigMapPod(f, volumeMountPath, podName) | 		err := createNonOptionalConfigMapPod(f, volumeMountPath, podName) | ||||||
| 		Expect(err).To(HaveOccurred(), "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	//ConfigMap object defined for the pod, If a key is specified which is not present in the ConfigMap, | 	//ConfigMap object defined for the pod, If a key is specified which is not present in the ConfigMap, | ||||||
| @@ -561,7 +561,7 @@ var _ = Describe("[sig-storage] ConfigMap", func() { | |||||||
| 		volumeMountPath := "/etc/configmap-volumes" | 		volumeMountPath := "/etc/configmap-volumes" | ||||||
| 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalConfigMapPodWithConfig(f, volumeMountPath, podName) | 		err := createNonOptionalConfigMapPodWithConfig(f, volumeMountPath, podName) | ||||||
| 		Expect(err).To(HaveOccurred(), "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -383,7 +383,7 @@ var _ = framework.KubeDescribe("Variable Expansion", func() { | |||||||
| 		pod = podClient.Create(pod) | 		pod = podClient.Create(pod) | ||||||
|  |  | ||||||
| 		err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout) | 		err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout) | ||||||
| 		Expect(err).To(HaveOccurred(), "while waiting for pod to be running") | 		framework.ExpectError(err, "while waiting for pod to be running") | ||||||
|  |  | ||||||
| 		By("updating the pod") | 		By("updating the pod") | ||||||
| 		podClient.Update(podName, func(pod *v1.Pod) { | 		podClient.Update(podName, func(pod *v1.Pod) { | ||||||
| @@ -651,7 +651,7 @@ func testPodFailSubpath(f *framework.Framework, pod *v1.Pod) { | |||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
| 	err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout) | 	err := framework.WaitTimeoutForPodRunningInNamespace(f.ClientSet, pod.Name, pod.Namespace, framework.PodStartShortTimeout) | ||||||
| 	Expect(err).To(HaveOccurred(), "while waiting for pod to be running") | 	framework.ExpectError(err, "while waiting for pod to be running") | ||||||
| } | } | ||||||
|  |  | ||||||
| // Tests that the existing subpath mount is detected when a container restarts | // Tests that the existing subpath mount is detected when a container restarts | ||||||
|   | |||||||
| @@ -20,7 +20,6 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
|  |  | ||||||
| 	"github.com/onsi/ginkgo" | 	"github.com/onsi/ginkgo" | ||||||
| 	"github.com/onsi/gomega" |  | ||||||
| 	"k8s.io/api/core/v1" | 	"k8s.io/api/core/v1" | ||||||
| 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||||||
| 	"k8s.io/kubernetes/test/e2e/framework" | 	"k8s.io/kubernetes/test/e2e/framework" | ||||||
| @@ -76,7 +75,7 @@ func (c *PrivilegedPodTestConfig) run(containerName string, expectSuccess bool) | |||||||
| 		framework.ExpectNoError(err, | 		framework.ExpectNoError(err, | ||||||
| 			fmt.Sprintf("could not remove dummy1 link: %v", err)) | 			fmt.Sprintf("could not remove dummy1 link: %v", err)) | ||||||
| 	} else { | 	} else { | ||||||
| 		gomega.Expect(err).To(gomega.HaveOccurred(), msg) | 		framework.ExpectError(err, msg) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -492,7 +492,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected configMap", func() { | |||||||
| 		volumeMountPath := "/etc/projected-configmap-volumes" | 		volumeMountPath := "/etc/projected-configmap-volumes" | ||||||
| 		podName := "pod-projected-configmaps-" + string(uuid.NewUUID()) | 		podName := "pod-projected-configmaps-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalConfigMapPod(f, volumeMountPath, podName) | 		err := createNonOptionalConfigMapPod(f, volumeMountPath, podName) | ||||||
| 		gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	//ConfigMap object defined for the pod, If a key is specified which is not present in the ConfigMap, | 	//ConfigMap object defined for the pod, If a key is specified which is not present in the ConfigMap, | ||||||
| @@ -502,7 +502,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected configMap", func() { | |||||||
| 		volumeMountPath := "/etc/configmap-volumes" | 		volumeMountPath := "/etc/configmap-volumes" | ||||||
| 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | 		podName := "pod-configmaps-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalConfigMapPodWithConfig(f, volumeMountPath, podName) | 		err := createNonOptionalConfigMapPodWithConfig(f, volumeMountPath, podName) | ||||||
| 		gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional configMap in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -410,7 +410,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected secret", func() { | |||||||
| 		volumeMountPath := "/etc/projected-secret-volumes" | 		volumeMountPath := "/etc/projected-secret-volumes" | ||||||
| 		podName := "pod-secrets-" + string(uuid.NewUUID()) | 		podName := "pod-secrets-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalSecretPod(f, volumeMountPath, podName) | 		err := createNonOptionalSecretPod(f, volumeMountPath, podName) | ||||||
| 		gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	//Secret object defined for the pod, If a key is specified which is not present in the secret, | 	//Secret object defined for the pod, If a key is specified which is not present in the secret, | ||||||
| @@ -420,7 +420,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected secret", func() { | |||||||
| 		volumeMountPath := "/etc/secret-volumes" | 		volumeMountPath := "/etc/secret-volumes" | ||||||
| 		podName := "pod-secrets-" + string(uuid.NewUUID()) | 		podName := "pod-secrets-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName) | 		err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName) | ||||||
| 		gomega.Expect(err).To(gomega.HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,7 +26,6 @@ import ( | |||||||
| 	imageutils "k8s.io/kubernetes/test/utils/image" | 	imageutils "k8s.io/kubernetes/test/utils/image" | ||||||
|  |  | ||||||
| 	. "github.com/onsi/ginkgo" | 	. "github.com/onsi/ginkgo" | ||||||
| 	. "github.com/onsi/gomega" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var _ = Describe("[sig-api-machinery] Secrets", func() { | var _ = Describe("[sig-api-machinery] Secrets", func() { | ||||||
| @@ -133,7 +132,7 @@ var _ = Describe("[sig-api-machinery] Secrets", func() { | |||||||
| 	*/ | 	*/ | ||||||
| 	framework.ConformanceIt("should fail to create secret due to empty secret key", func() { | 	framework.ConformanceIt("should fail to create secret due to empty secret key", func() { | ||||||
| 		secret, err := createEmptyKeySecretForTest(f) | 		secret, err := createEmptyKeySecretForTest(f) | ||||||
| 		Expect(err).To(HaveOccurred(), "created secret %q with empty key in namespace %q", secret.Name, f.Namespace.Name) | 		framework.ExpectError(err, "created secret %q with empty key in namespace %q", secret.Name, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -375,7 +375,7 @@ var _ = Describe("[sig-storage] Secrets", func() { | |||||||
| 		volumeMountPath := "/etc/secret-volumes" | 		volumeMountPath := "/etc/secret-volumes" | ||||||
| 		podName := "pod-secrets-" + string(uuid.NewUUID()) | 		podName := "pod-secrets-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalSecretPod(f, volumeMountPath, podName) | 		err := createNonOptionalSecretPod(f, volumeMountPath, podName) | ||||||
| 		Expect(err).To(HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	//Secret object defined for the pod, If a key is specified which is not present in the secret, | 	//Secret object defined for the pod, If a key is specified which is not present in the secret, | ||||||
| @@ -385,7 +385,7 @@ var _ = Describe("[sig-storage] Secrets", func() { | |||||||
| 		volumeMountPath := "/etc/secret-volumes" | 		volumeMountPath := "/etc/secret-volumes" | ||||||
| 		podName := "pod-secrets-" + string(uuid.NewUUID()) | 		podName := "pod-secrets-" + string(uuid.NewUUID()) | ||||||
| 		err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName) | 		err := createNonOptionalSecretPodWithSecret(f, volumeMountPath, podName) | ||||||
| 		Expect(err).To(HaveOccurred(), "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | 		framework.ExpectError(err, "created pod %q with non-optional secret in namespace %q", podName, f.Namespace.Name) | ||||||
| 	}) | 	}) | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot