(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func TestBoltTransportRetrieveAllHistory(t *testing.T) { |
| 108 | t.Parallel() |
| 109 | |
| 110 | transport := createBoltTransport(t, 0, 0) |
| 111 | ctx := t.Context() |
| 112 | |
| 113 | topics := []string{"https://example.com/foo"} |
| 114 | for i := 1; i <= 10; i++ { |
| 115 | require.NoError(t, transport.Dispatch(ctx, &Update{ |
| 116 | Event: Event{ID: strconv.Itoa(i)}, |
| 117 | Topics: topics, |
| 118 | })) |
| 119 | } |
| 120 | |
| 121 | s := NewLocalSubscriber(EarliestLastEventID, transport.logger, &TopicSelectorStore{}) |
| 122 | s.SetTopics(topics, nil) |
| 123 | require.NoError(t, transport.AddSubscriber(ctx, s)) |
| 124 | |
| 125 | var count int |
| 126 | |
| 127 | for { |
| 128 | u := <-s.Receive() |
| 129 | // the reading loop must read all messages |
| 130 | count++ |
| 131 | assert.Equal(t, strconv.Itoa(count), u.ID) |
| 132 | |
| 133 | if count == 10 { |
| 134 | break |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | assert.Equal(t, 10, count) |
| 139 | } |
| 140 | |
| 141 | func TestBoltTransportHistoryAndLive(t *testing.T) { |
| 142 | t.Parallel() |
nothing calls this directly
no test coverage detected