Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gitaly-wrapper/main_test.go')
-rw-r--r--cmd/gitaly-wrapper/main_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/cmd/gitaly-wrapper/main_test.go b/cmd/gitaly-wrapper/main_test.go
index 2b5778142..59963da52 100644
--- a/cmd/gitaly-wrapper/main_test.go
+++ b/cmd/gitaly-wrapper/main_test.go
@@ -1,6 +1,7 @@
package main
import (
+ "errors"
"io/ioutil"
"os"
"os/exec"
@@ -44,3 +45,36 @@ func TestStolenPid(t *testing.T) {
require.True(t, isGitaly(tail, "/path/to/tail"))
})
}
+
+func TestIsRecoverable(t *testing.T) {
+ _, numericError := strconv.Atoi("")
+
+ tests := []struct {
+ name string
+ err error
+ want bool
+ }{
+ {
+ name: "file doesn't exist",
+ err: os.ErrNotExist,
+ want: true,
+ },
+ {
+ name: "numeric error",
+ err: numericError,
+ want: true,
+ },
+ {
+ name: "generic error",
+ err: errors.New("generic error"),
+ want: false,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := isRecoverable(tt.err); got != tt.want {
+ t.Errorf("isRecoverable() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}