mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
55 lines
1.1 KiB
Go
55 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)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|