(t *testing.T)
| 232 | } |
| 233 | |
| 234 | func TestWalBlockIterator(t *testing.T) { |
| 235 | testWalBlock(t, func(w *walBlock, ids []common.ID, trs []*tempopb.Trace) { |
| 236 | iter, err := w.Iterator(context.Background()) |
| 237 | require.NoError(t, err) |
| 238 | defer iter.Close() |
| 239 | |
| 240 | count := 0 |
| 241 | for ; ; count++ { |
| 242 | id, tr, err := iter.Next(context.Background()) |
| 243 | require.NoError(t, err) |
| 244 | |
| 245 | if id == nil { |
| 246 | break |
| 247 | } |
| 248 | |
| 249 | // Find trace in the input data |
| 250 | match := -1 |
| 251 | for i := range ids { |
| 252 | if bytes.Equal(ids[i], id) { |
| 253 | match = i |
| 254 | break |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | require.NotEqual(t, -1, match, "iterator returned unexpected id") |
| 259 | require.Equal(t, ids[match], id) |
| 260 | require.True(t, proto.Equal(trs[match], tr)) |
| 261 | } |
| 262 | require.Equal(t, len(ids), count) |
| 263 | }) |
| 264 | } |
| 265 | |
| 266 | // TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals |
| 267 | // of walblock. it also ignores the passed in traces and ids and simply asserts that the row iterator |
nothing calls this directly
no test coverage detected