(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestBuildTablesMetadata(t *testing.T) { |
| 13 | testCases := []struct { |
| 14 | input *storepb.TableMetadata |
| 15 | wantNames []string |
| 16 | wantColumns []*storepb.ColumnMetadata |
| 17 | }{ |
| 18 | // No partitions. |
| 19 | { |
| 20 | input: &storepb.TableMetadata{ |
| 21 | Name: "orders", |
| 22 | Columns: []*storepb.ColumnMetadata{ |
| 23 | { |
| 24 | Name: "id", |
| 25 | }, |
| 26 | }, |
| 27 | }, |
| 28 | wantNames: []string{"orders"}, |
| 29 | wantColumns: []*storepb.ColumnMetadata{ |
| 30 | { |
| 31 | Name: "id", |
| 32 | }, |
| 33 | }, |
| 34 | }, |
| 35 | // Nested partitions. |
| 36 | { |
| 37 | input: &storepb.TableMetadata{ |
| 38 | Name: "orders", |
| 39 | Columns: []*storepb.ColumnMetadata{ |
| 40 | { |
| 41 | Name: "id", |
| 42 | }, |
| 43 | }, |
| 44 | Partitions: []*storepb.TablePartitionMetadata{ |
| 45 | { |
| 46 | Name: "orders_0_100", |
| 47 | Subpartitions: []*storepb.TablePartitionMetadata{ |
| 48 | { |
| 49 | Name: "orders_0_50", |
| 50 | }, |
| 51 | { |
| 52 | Name: "orders_50_100", |
| 53 | }, |
| 54 | }, |
| 55 | }, |
| 56 | { |
| 57 | Name: "orders_100_200", |
| 58 | Subpartitions: []*storepb.TablePartitionMetadata{ |
| 59 | { |
| 60 | Name: "orders_100_150", |
| 61 | }, |
| 62 | { |
| 63 | Name: "orders_150_200", |
| 64 | }, |
| 65 | }, |
| 66 | }, |
| 67 | }, |
| 68 | }, |
| 69 | wantNames: []string{"orders", "orders_0_100", "orders_0_50", "orders_50_100", "orders_100_200", "orders_100_150", "orders_150_200"}, |
nothing calls this directly
no test coverage detected