testAllMessagesReceived ensures that after n reads, all msgs in msgs have been read.
(cl *client, n int, msgs map[string]struct{})
| 137 | // testAllMessagesReceived ensures that after n reads, all msgs in msgs |
| 138 | // have been read. |
| 139 | func testAllMessagesReceived(cl *client, n int, msgs map[string]struct{}) error { |
| 140 | msgs = cloneMessages(msgs) |
| 141 | |
| 142 | for i := 0; i < n; i++ { |
| 143 | msg, err := cl.nextMessage() |
| 144 | if err != nil { |
| 145 | return err |
| 146 | } |
| 147 | delete(msgs, msg) |
| 148 | } |
| 149 | |
| 150 | if len(msgs) != 0 { |
| 151 | return fmt.Errorf("did not receive all expected messages: %q", msgs) |
| 152 | } |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | func cloneMessages(msgs map[string]struct{}) map[string]struct{} { |
| 157 | msgs2 := make(map[string]struct{}, len(msgs)) |
no test coverage detected
searching dependent graphs…