MCPcopy
hub / github.com/hashicorp/memberlist / TestMemberlist_FailedRemote

Function TestMemberlist_FailedRemote

state_test.go:2411–2442  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2409}
2410
2411func TestMemberlist_FailedRemote(t *testing.T) {
2412 type test struct {
2413 name string
2414 err error
2415 expected bool
2416 }
2417 tests := []test{
2418 {"nil error", nil, false},
2419 {"normal error", fmt.Errorf(""), false},
2420 {"net.OpError for file", &net.OpError{Net: "file"}, false},
2421 {"net.OpError for udp", &net.OpError{Net: "udp"}, false},
2422 {"net.OpError for udp4", &net.OpError{Net: "udp4"}, false},
2423 {"net.OpError for udp6", &net.OpError{Net: "udp6"}, false},
2424 {"net.OpError for tcp", &net.OpError{Net: "tcp"}, false},
2425 {"net.OpError for tcp4", &net.OpError{Net: "tcp4"}, false},
2426 {"net.OpError for tcp6", &net.OpError{Net: "tcp6"}, false},
2427 {"net.OpError for tcp with dial", &net.OpError{Net: "tcp", Op: "dial"}, true},
2428 {"net.OpError for tcp with write", &net.OpError{Net: "tcp", Op: "write"}, true},
2429 {"net.OpError for tcp with read", &net.OpError{Net: "tcp", Op: "read"}, true},
2430 {"net.OpError for udp with write", &net.OpError{Net: "udp", Op: "write"}, true},
2431 {"net.OpError for udp with read", &net.OpError{Net: "udp", Op: "read"}, false},
2432 }
2433
2434 for _, test := range tests {
2435 t.Run(test.name, func(t *testing.T) {
2436 actual := failedRemote(test.err)
2437 if actual != test.expected {
2438 t.Fatalf("expected %t, got %t", test.expected, actual)
2439 }
2440 })
2441 }
2442}
2443
2444func TestMemberlist_PushPull(t *testing.T) {
2445 addr1 := getBindAddr()

Callers

nothing calls this directly

Calls 3

failedRemoteFunction · 0.85
ErrorfMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…