-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtunnel_copy_test.go
More file actions
34 lines (29 loc) · 714 Bytes
/
Copy pathtunnel_copy_test.go
File metadata and controls
34 lines (29 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package sshlib
import (
"io"
"syscall"
"testing"
)
func TestShouldRetryTunnelCopyError(t *testing.T) {
t.Parallel()
tests := []struct {
name string
err error
want bool
}{
{name: "eio", err: syscall.EIO, want: true},
{name: "ehostdown", err: syscall.EHOSTDOWN, want: true},
{name: "eagain", err: syscall.EAGAIN, want: true},
{name: "ewouldblock", err: syscall.EWOULDBLOCK, want: true},
{name: "eof", err: io.EOF, want: false},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := shouldRetryTunnelCopyError(tt.err); got != tt.want {
t.Fatalf("shouldRetryTunnelCopyError(%v) = %v, want %v", tt.err, got, tt.want)
}
})
}
}