MCPcopy
hub / github.com/redis/go-redis / TestWantConn_tryDeliver_AlreadyDone

Function TestWantConn_tryDeliver_AlreadyDone

internal/pool/want_conn_test.go:108–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestWantConn_tryDeliver_AlreadyDone(t *testing.T) {
109 w := &wantConn{
110 ctx: context.Background(),
111 done: true, // Already done
112 result: make(chan wantConnResult, 1),
113 }
114
115 // Test delivery when already done
116 delivered := w.tryDeliver(&Conn{}, nil)
117 if delivered {
118 t.Error("tryDeliver() = true, want false when already done")
119 }
120
121 // Check that no result is sent
122 select {
123 case <-w.result:
124 t.Error("No result should be sent when already done")
125 case <-time.After(time.Millisecond):
126 // Expected
127 }
128}
129
130func TestWantConn_cancel_NotDone(t *testing.T) {
131 w := &wantConn{

Callers

nothing calls this directly

Calls 2

tryDeliverMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected