(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestBoltTransportHistory(t *testing.T) { |
| 38 | t.Parallel() |
| 39 | |
| 40 | transport := createBoltTransport(t, 0, 0) |
| 41 | |
| 42 | topics := []string{"https://example.com/foo"} |
| 43 | for i := 1; i <= 10; i++ { |
| 44 | require.NoError(t, transport.Dispatch(t.Context(), &Update{ |
| 45 | Event: Event{ID: strconv.Itoa(i)}, |
| 46 | Topics: topics, |
| 47 | })) |
| 48 | } |
| 49 | |
| 50 | s := NewLocalSubscriber("8", transport.logger, &TopicSelectorStore{}) |
| 51 | s.SetTopics(topics, nil) |
| 52 | |
| 53 | require.NoError(t, transport.AddSubscriber(t.Context(), s)) |
| 54 | |
| 55 | var count int |
| 56 | |
| 57 | for { |
| 58 | u := <-s.Receive() |
| 59 | // the reading loop must read the #9 and #10 messages |
| 60 | assert.Equal(t, strconv.Itoa(9+count), u.ID) |
| 61 | |
| 62 | count++ |
| 63 | if count == 2 { |
| 64 | return |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | func TestBoltTransportLogsBogusLastEventID(t *testing.T) { |
| 70 | t.Parallel() |
nothing calls this directly
no test coverage detected