diff --git a/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go b/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go index 6f5232cd3ae..0246d6a43ed 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go +++ b/staging/src/k8s.io/cli-runtime/pkg/resource/builder_test.go @@ -1051,9 +1051,12 @@ func TestRestMappingErrors(t *testing.T) { // ensure that requesting a resource we _know_ not to exist results in an expected *meta.NoKindMatchError err := b.Do().IntoSingleItemImplied(&singleItemImplied).Visit(test.Handle) if err != nil { - if !errors.Is(err, &meta.NoKindMatchError{}) { + if !strings.Contains(err.Error(), "server doesn't have a resource type \"foo\"") { t.Fatalf("unexpected error: %v", err) } + if !errors.Is(err, &meta.NoKindMatchError{}) { + t.Fatalf("unexpected error type: %v", err) + } } expectedErr := fmt.Errorf("expected error")