mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 23:57:49 +00:00
check for error message and type
This commit is contained in:
parent
10a6885da1
commit
fd5353eb72
@ -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
|
// ensure that requesting a resource we _know_ not to exist results in an expected *meta.NoKindMatchError
|
||||||
err := b.Do().IntoSingleItemImplied(&singleItemImplied).Visit(test.Handle)
|
err := b.Do().IntoSingleItemImplied(&singleItemImplied).Visit(test.Handle)
|
||||||
if err != nil {
|
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)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
|
if !errors.Is(err, &meta.NoKindMatchError{}) {
|
||||||
|
t.Fatalf("unexpected error type: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedErr := fmt.Errorf("expected error")
|
expectedErr := fmt.Errorf("expected error")
|
||||||
|
Loading…
Reference in New Issue
Block a user