(t *testing.T)
| 37 | func (m *mockJobSharder) Owns(_ string) bool { return m.owns } |
| 38 | |
| 39 | func TestTenantIndexBuilder(t *testing.T) { |
| 40 | var ( |
| 41 | one = backend.MustParse("00000000-0000-0000-0000-000000000001") |
| 42 | two = backend.MustParse("00000000-0000-0000-0000-000000000002") |
| 43 | three = backend.MustParse("00000000-0000-0000-0000-000000000003") |
| 44 | ) |
| 45 | |
| 46 | tests := []struct { |
| 47 | name string |
| 48 | list PerTenant |
| 49 | compactedList PerTenantCompacted |
| 50 | expectedList PerTenant |
| 51 | expectedCompactedList PerTenantCompacted |
| 52 | expectsError bool |
| 53 | }{ |
| 54 | { |
| 55 | name: "nothing!", |
| 56 | expectedList: PerTenant{}, |
| 57 | expectedCompactedList: PerTenantCompacted{}, |
| 58 | }, |
| 59 | { |
| 60 | name: "err", |
| 61 | list: PerTenant{ |
| 62 | "test": []*backend.BlockMeta{ |
| 63 | { |
| 64 | BlockID: one, |
| 65 | }, |
| 66 | }, |
| 67 | }, |
| 68 | expectsError: true, |
| 69 | }, |
| 70 | { |
| 71 | name: "block meta", |
| 72 | list: PerTenant{ |
| 73 | "test": []*backend.BlockMeta{ |
| 74 | { |
| 75 | BlockID: one, |
| 76 | }, |
| 77 | }, |
| 78 | }, |
| 79 | expectedList: PerTenant{ |
| 80 | "test": []*backend.BlockMeta{ |
| 81 | { |
| 82 | BlockID: one, |
| 83 | }, |
| 84 | }, |
| 85 | }, |
| 86 | expectedCompactedList: PerTenantCompacted{ |
| 87 | "test": []*backend.CompactedBlockMeta{}, |
| 88 | }, |
| 89 | }, |
| 90 | { |
| 91 | name: "compacted block meta", |
| 92 | compactedList: PerTenantCompacted{ |
| 93 | "test": []*backend.CompactedBlockMeta{ |
| 94 | { |
| 95 | BlockMeta: backend.BlockMeta{ |
| 96 | BlockID: one, |
nothing calls this directly
no test coverage detected