(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestWalBlockIterator(t *testing.T) { |
| 234 | testWalBlock(t, func(w *walBlock, ids []common.ID, trs []*tempopb.Trace) { |
| 235 | iter, err := w.Iterator(context.Background()) |
| 236 | require.NoError(t, err) |
| 237 | |
| 238 | count := 0 |
| 239 | for ; ; count++ { |
| 240 | id, tr, err := iter.Next(context.Background()) |
| 241 | require.NoError(t, err) |
| 242 | |
| 243 | if id == nil { |
| 244 | break |
| 245 | } |
| 246 | |
| 247 | // Find trace in the input data |
| 248 | match := 0 |
| 249 | for i := range ids { |
| 250 | if bytes.Equal(ids[i], id) { |
| 251 | match = i |
| 252 | break |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | require.Equal(t, ids[match], id) |
| 257 | require.True(t, proto.Equal(trs[match], tr)) |
| 258 | } |
| 259 | require.Equal(t, len(ids), count) |
| 260 | }) |
| 261 | } |
| 262 | |
| 263 | // TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals |
| 264 | // 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