Skip to content

Commit f55d28c

Browse files
author
Shawn Hurley
committed
using kapierrors to check error condition in client.
1 parent ea3bb50 commit f55d28c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/client/client_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
. "github.com/onsi/gomega"
2626
appsv1 "k8s.io/api/apps/v1"
2727
corev1 "k8s.io/api/core/v1"
28+
"k8s.io/apimachinery/pkg/api/errors"
2829
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3031
"k8s.io/apimachinery/pkg/runtime"
@@ -216,7 +217,7 @@ var _ = Describe("Client", func() {
216217
By("creating the object a second time")
217218
err = cl.Create(context.TODO(), old)
218219
Expect(err).To(HaveOccurred())
219-
Expect(err.Error()).To(ContainSubstring("already exists"))
220+
Expect(errors.IsAlreadyExists(err)).To(BeTrue())
220221

221222
close(done)
222223
})
@@ -337,7 +338,7 @@ var _ = Describe("Client", func() {
337338
By("creating the object a second time")
338339
err = cl.Create(context.TODO(), u)
339340
Expect(err).To(HaveOccurred())
340-
Expect(err.Error()).To(ContainSubstring("already exists"))
341+
Expect(errors.IsAlreadyExists(err)).To(BeTrue())
341342

342343
close(done)
343344
})

0 commit comments

Comments
 (0)