mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
9ac141fcb9
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
54 lines
1.1 KiB
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|