(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 | defer iter.Close() |
| 238 | |
| 239 | count := 0 |
| 240 | for ; ; count++ { |
| 241 | id, tr, err := iter.Next(context.Background()) |
| 242 | require.NoError(t, err) |
| 243 | |
| 244 | if id == nil { |
| 245 | break |
| 246 | } |
| 247 | |
| 248 | // Find trace in the input data |
| 249 | match := -1 |
| 250 | for i := range ids { |
| 251 | if bytes.Equal(ids[i], id) { |
| 252 | match = i |
| 253 | break |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | require.NotEqual(t, -1, match, "iterator returned unexpected id") |
| 258 | require.Equal(t, ids[match], id) |
| 259 | require.True(t, proto.Equal(trs[match], tr)) |
| 260 | } |
| 261 | require.Equal(t, len(ids), count) |
| 262 | }) |
| 263 | } |
| 264 | |
| 265 | // TestRowIterator cheats a bit by testing the rowIterator directly by reaching into the internals |
| 266 | // 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