(t *testing.T)
| 295 | } |
| 296 | |
| 297 | func TestPollBlock(t *testing.T) { |
| 298 | one := backend.MustParse("00000000-0000-0000-0000-000000000001") |
| 299 | |
| 300 | tests := []struct { |
| 301 | name string |
| 302 | list PerTenant |
| 303 | compactedList PerTenantCompacted |
| 304 | pollTenantID string |
| 305 | pollBlockID backend.UUID |
| 306 | expectedMeta *backend.BlockMeta |
| 307 | expectedCompactedMeta *backend.CompactedBlockMeta |
| 308 | expectsError bool |
| 309 | }{ |
| 310 | { |
| 311 | name: "block and tenant don't exist", |
| 312 | pollTenantID: "test", |
| 313 | pollBlockID: one, |
| 314 | }, |
| 315 | { |
| 316 | name: "block exists", |
| 317 | pollTenantID: "test", |
| 318 | pollBlockID: one, |
| 319 | list: PerTenant{ |
| 320 | "test": []*backend.BlockMeta{ |
| 321 | { |
| 322 | BlockID: one, |
| 323 | }, |
| 324 | }, |
| 325 | }, |
| 326 | expectedMeta: &backend.BlockMeta{ |
| 327 | BlockID: one, |
| 328 | }, |
| 329 | }, |
| 330 | { |
| 331 | name: "compactedblock exists", |
| 332 | pollTenantID: "test", |
| 333 | pollBlockID: one, |
| 334 | compactedList: PerTenantCompacted{ |
| 335 | "test": []*backend.CompactedBlockMeta{ |
| 336 | { |
| 337 | BlockMeta: backend.BlockMeta{ |
| 338 | BlockID: one, |
| 339 | }, |
| 340 | }, |
| 341 | }, |
| 342 | }, |
| 343 | expectedCompactedMeta: &backend.CompactedBlockMeta{ |
| 344 | BlockMeta: backend.BlockMeta{ |
| 345 | BlockID: one, |
| 346 | }, |
| 347 | }, |
| 348 | }, |
| 349 | { |
| 350 | name: "errors", |
| 351 | pollTenantID: "test", |
| 352 | pollBlockID: one, |
| 353 | compactedList: PerTenantCompacted{ |
| 354 | "test": []*backend.CompactedBlockMeta{ |
nothing calls this directly
no test coverage detected