mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
e2e_cloud:stop using deprecated framework.ExpectError
This commit is contained in:
parent
7bde29372a
commit
a56745c706
@ -340,7 +340,7 @@ var _ = SIGDescribe("Addon update", func() {
|
|||||||
|
|
||||||
ginkgo.By("verify invalid addons weren't created")
|
ginkgo.By("verify invalid addons weren't created")
|
||||||
_, err = f.ClientSet.CoreV1().ReplicationControllers(addonNsName).Get(ctx, "invalid-addon-test", metav1.GetOptions{})
|
_, err = f.ClientSet.CoreV1().ReplicationControllers(addonNsName).Get(ctx, "invalid-addon-test", metav1.GetOptions{})
|
||||||
framework.ExpectError(err)
|
gomega.Expect(err).To(gomega.HaveOccurred())
|
||||||
|
|
||||||
// Invalid addon manifests and the "ensure exist class" addon will be deleted by the deferred function.
|
// Invalid addon manifests and the "ensure exist class" addon will be deleted by the deferred function.
|
||||||
})
|
})
|
||||||
|
@ -138,7 +138,7 @@ var _ = SIGDescribe("ConfigMap", func() {
|
|||||||
*/
|
*/
|
||||||
framework.ConformanceIt("should fail to create ConfigMap with empty key", func(ctx context.Context) {
|
framework.ConformanceIt("should fail to create ConfigMap with empty key", func(ctx context.Context) {
|
||||||
configMap, err := newConfigMapWithEmptyKey(ctx, f)
|
configMap, err := newConfigMapWithEmptyKey(ctx, f)
|
||||||
framework.ExpectError(err, "created configMap %q with empty key in namespace %q", configMap.Name, f.Namespace.Name)
|
gomega.Expect(err).To(gomega.HaveOccurred(), "created configMap %q with empty key in namespace %q", configMap.Name, f.Namespace.Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should update ConfigMap successfully", func(ctx context.Context) {
|
ginkgo.It("should update ConfigMap successfully", func(ctx context.Context) {
|
||||||
|
@ -1067,7 +1067,7 @@ var _ = SIGDescribe("Pods", func() {
|
|||||||
if postDeletePod != nil {
|
if postDeletePod != nil {
|
||||||
postDeletePodJSON, _ = json.Marshal(postDeletePod)
|
postDeletePodJSON, _ = json.Marshal(postDeletePod)
|
||||||
}
|
}
|
||||||
framework.ExpectError(err, "pod %v found in namespace %v, but it should be deleted: %s", testPodName, testNamespaceName, string(postDeletePodJSON))
|
gomega.Expect(err).To(gomega.HaveOccurred(), "pod %v found in namespace %v, but it should be deleted: %s", testPodName, testNamespaceName, string(postDeletePodJSON))
|
||||||
if !apierrors.IsNotFound(err) {
|
if !apierrors.IsNotFound(err) {
|
||||||
framework.Failf("expected IsNotFound error, got %#v", err)
|
framework.Failf("expected IsNotFound error, got %#v", err)
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
|
"github.com/onsi/gomega"
|
||||||
v1 "k8s.io/api/core/v1"
|
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"
|
||||||
@ -81,7 +82,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 {
|
||||||
framework.ExpectError(err, msg)
|
gomega.Expect(err).To(gomega.HaveOccurred(), msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ func createRuntimeClass(ctx context.Context, f *framework.Framework, name, handl
|
|||||||
|
|
||||||
func expectPodRejection(ctx context.Context, f *framework.Framework, pod *v1.Pod) {
|
func expectPodRejection(ctx context.Context, f *framework.Framework, pod *v1.Pod) {
|
||||||
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, pod, metav1.CreateOptions{})
|
_, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Create(ctx, pod, metav1.CreateOptions{})
|
||||||
framework.ExpectError(err, "should be forbidden")
|
gomega.Expect(err).To(gomega.HaveOccurred(), "should be forbidden")
|
||||||
if !apierrors.IsForbidden(err) {
|
if !apierrors.IsForbidden(err) {
|
||||||
framework.Failf("expected forbidden error, got %#v", err)
|
framework.Failf("expected forbidden error, got %#v", err)
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ var _ = SIGDescribe("Secrets", func() {
|
|||||||
*/
|
*/
|
||||||
framework.ConformanceIt("should fail to create secret due to empty secret key", func(ctx context.Context) {
|
framework.ConformanceIt("should fail to create secret due to empty secret key", func(ctx context.Context) {
|
||||||
secret, err := createEmptyKeySecretForTest(ctx, f)
|
secret, err := createEmptyKeySecretForTest(ctx, f)
|
||||||
framework.ExpectError(err, "created secret %q with empty key in namespace %q", secret.Name, f.Namespace.Name)
|
gomega.Expect(err).To(gomega.HaveOccurred(), "created secret %q with empty key in namespace %q", secret.Name, f.Namespace.Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -706,5 +706,5 @@ func VerifyExecInPodFail(f *framework.Framework, pod *v1.Pod, shExec string, exi
|
|||||||
shExec, exitCode, err, stdout, stderr)
|
shExec, exitCode, err, stdout, stderr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
framework.ExpectError(err, "%q should fail with exit code %d, but exit without error", shExec, exitCode)
|
gomega.Expect(err).To(gomega.HaveOccurred(), "%q should fail with exit code %d, but exit without error", shExec, exitCode)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user