MCPcopy
hub / github.com/IBM/sarama / TestSentinelWithMultipleWrappedErrors

Function TestSentinelWithMultipleWrappedErrors

errors_test.go:44–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestSentinelWithMultipleWrappedErrors(t *testing.T) {
45 t.Parallel()
46 myNetError := &net.OpError{}
47 myAddrError := &net.AddrError{}
48
49 error := Wrap(ErrOutOfBrokers, myNetError, myAddrError)
50
51 if !errors.Is(error, ErrOutOfBrokers) {
52 t.Error("errors.Is unexpected result")
53 }
54
55 if !errors.Is(error, myNetError) {
56 t.Error("errors.Is unexpected result")
57 }
58
59 if !errors.Is(error, myAddrError) {
60 t.Error("errors.Is unexpected result")
61 }
62
63 unwrapped := errors.Unwrap(error)
64 if errors.Is(unwrapped, ErrOutOfBrokers) || !errors.Is(unwrapped, myNetError) || !errors.Is(unwrapped, myAddrError) {
65 t.Errorf("unwrapped value unexpected result")
66 }
67}

Callers

nothing calls this directly

Calls 5

WrapFunction · 0.85
IsMethod · 0.80
ErrorMethod · 0.65
ErrorfMethod · 0.65
UnwrapMethod · 0.45

Tested by

no test coverage detected