(t *testing.T)
| 1101 | } |
| 1102 | |
| 1103 | func TestCloseChanOnSubscriber(t *testing.T) { |
| 1104 | s := RunDefaultServer() |
| 1105 | defer s.Shutdown() |
| 1106 | |
| 1107 | nc := NewDefaultConnection(t) |
| 1108 | defer nc.Close() |
| 1109 | |
| 1110 | // Create our own channel. |
| 1111 | ch := make(chan *nats.Msg, 8) |
| 1112 | nc.ChanSubscribe("foo", ch) |
| 1113 | |
| 1114 | // Send some messages to ourselves. |
| 1115 | total := 100 |
| 1116 | for range total { |
| 1117 | nc.Publish("foo", []byte("Hello")) |
| 1118 | } |
| 1119 | |
| 1120 | nc.Close() |
| 1121 | for len(ch) > 0 { |
| 1122 | <-ch |
| 1123 | } |
| 1124 | // Make sure we can send to the channel still. |
| 1125 | // Test that we do not close it. |
| 1126 | ch <- &nats.Msg{} |
| 1127 | } |
| 1128 | |
| 1129 | func TestAsyncSubscriptionPending(t *testing.T) { |
| 1130 | s := RunDefaultServer() |
nothing calls this directly
no test coverage detected