TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator is internally consistent.
(t *testing.T)
| 266 | // of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator |
| 267 | // is internally consistent. |
| 268 | func TestRowIterator(t *testing.T) { |
| 269 | testWalBlock(t, func(w *walBlock, _ []common.ID, _ []*tempopb.Trace) { |
| 270 | for _, f := range w.flushed { |
| 271 | ri, err := f.rowIterator(context.Background()) |
| 272 | require.NoError(t, err) |
| 273 | |
| 274 | var lastID []byte |
| 275 | for { |
| 276 | peekID, err := ri.peekNextID(context.Background()) |
| 277 | require.NoError(t, err) |
| 278 | |
| 279 | peekAgainID, err := ri.peekNextID(context.Background()) |
| 280 | require.NoError(t, err) |
| 281 | require.Equal(t, peekID, peekAgainID) |
| 282 | |
| 283 | id, _, err := ri.Next(context.Background()) |
| 284 | require.NoError(t, err) |
| 285 | require.Equal(t, peekID, id) |
| 286 | if id == nil { |
| 287 | break |
| 288 | } |
| 289 | |
| 290 | // make sure ordering is correct |
| 291 | require.True(t, bytes.Compare(lastID, id) < 0, "ids not in order: %v %v", lastID, id) |
| 292 | |
| 293 | lastID = append([]byte(nil), id...) |
| 294 | } |
| 295 | } |
| 296 | }) |
| 297 | } |
| 298 | |
| 299 | func TestIteratorContextCancelled(t *testing.T) { |
| 300 | t.Run("already cancelled", func(t *testing.T) { |
nothing calls this directly
no test coverage detected