@@ -20,6 +20,7 @@ import (
20
20
"bufio"
21
21
"bytes"
22
22
"context"
23
+ "errors"
23
24
"flag"
24
25
"fmt"
25
26
"io"
@@ -33,7 +34,7 @@ import (
33
34
34
35
"github.com/google/go-cmp/cmp"
35
36
"github.com/mattn/go-shellwords"
36
- "k8s.io/apimachinery/pkg/api/errors"
37
+ k8serrors "k8s.io/apimachinery/pkg/api/errors"
37
38
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
38
39
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
39
40
"k8s.io/client-go/tools/clientcmd"
@@ -115,7 +116,7 @@ func (m *testEnvKubeManager) CreateObjects(clientObjects []*unstructured.Unstruc
115
116
obj .SetResourceVersion (createObj .GetResourceVersion ())
116
117
err = m .client .Status ().Update (context .Background (), obj )
117
118
// Updating status of static objects results in not found error.
118
- if err != nil && ! errors .IsNotFound (err ) {
119
+ if err != nil && ! k8serrors .IsNotFound (err ) {
119
120
return err
120
121
}
121
122
}
@@ -272,6 +273,15 @@ func assertError(expected string) assertFunc {
272
273
}
273
274
}
274
275
276
+ func assertErrorIs (want error ) assertFunc {
277
+ return func (_ string , got error ) error {
278
+ if errors .Is (got , want ) {
279
+ return nil
280
+ }
281
+ return fmt .Errorf ("Expected error '%v' but got '%v'" , want , got )
282
+ }
283
+ }
284
+
275
285
// Expect the command to succeed with the expected test output.
276
286
func assertGoldenValue (expected string ) assertFunc {
277
287
return assert (
0 commit comments