MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestBuildTablesMetadata

Function TestBuildTablesMetadata

backend/store/model/database_test.go:12–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func 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"},

Callers

nothing calls this directly

Calls 5

buildTablesMetadataFunction · 0.85
EqualMethod · 0.65
GetColumnsMethod · 0.45
GetProtoMethod · 0.45
GetColumnMethod · 0.45

Tested by

no test coverage detected