1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/clients/dclient/utils_test.go
Charles-Edouard Brétéché 9ac141fcb9
fix: don't filter on group when service based apiservice discovery fails (#6766)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-03 14:44:01 +00:00

54 lines
1.1 KiB
Go

package dclient
import (
"errors"
"testing"
)
func Test_isServerCurrentlyUnableToHandleRequest(t *testing.T) {
type args struct {
err error
}
tests := []struct {
name string
args args
want bool
}{{
args: args{
err: nil,
},
want: false,
}, {
args: args{
err: errors.New("another error"),
},
want: false,
}, {
args: args{
err: errors.New("the server is currently unable to handle the request"),
},
want: true,
}, {
args: args{
err: errors.New("a prefix : the server is currently unable to handle the request"),
},
want: true,
}, {
args: args{
err: errors.New("the server is currently unable to handle the request - a suffix"),
},
want: true,
}, {
args: args{
err: errors.New("a prefix : the server is currently unable to handle the request - a suffix"),
},
want: true,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isServerCurrentlyUnableToHandleRequest(tt.args.err); got != tt.want {
t.Errorf("isServerCurrentlyUnableToHandleRequest() = %v, want %v", got, tt.want)
}
})
}
}