(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestRegionSplitInfo(t *testing.T) { |
| 104 | // config format: |
| 105 | // MySQL [(none)]> show config where name = 'coprocessor.region-split-size'; |
| 106 | // +------+-------------------+-------------------------------+-------+ |
| 107 | // | Type | Instance | Name | Value | |
| 108 | // +------+-------------------+-------------------------------+-------+ |
| 109 | // | tikv | 127.0.0.1:20161 | coprocessor.region-split-size | 10MB | |
| 110 | // +------+-------------------+-------------------------------+-------+ |
| 111 | // MySQL [(none)]> show config where name = 'coprocessor.region-split-keys'; |
| 112 | // +------+-------------------+-------------------------------+--------+ |
| 113 | // | Type | Instance | Name | Value | |
| 114 | // +------+-------------------+-------------------------------+--------+ |
| 115 | // | tikv | 127.0.0.1:20161 | coprocessor.region-split-keys | 100000 | |
| 116 | // +------+-------------------+-------------------------------+--------+ |
| 117 | |
| 118 | fields := make([]*resolve.ResultField, 4) |
| 119 | tps := []*types.FieldType{ |
| 120 | types.NewFieldType(mysql.TypeString), |
| 121 | types.NewFieldType(mysql.TypeString), |
| 122 | types.NewFieldType(mysql.TypeString), |
| 123 | types.NewFieldType(mysql.TypeString), |
| 124 | } |
| 125 | for i := 0; i < len(tps); i++ { |
| 126 | rf := new(resolve.ResultField) |
| 127 | rf.Column = new(model.ColumnInfo) |
| 128 | rf.Column.FieldType = *tps[i] |
| 129 | fields[i] = rf |
| 130 | } |
| 131 | rows := make([]chunk.Row, 0, 1) |
| 132 | row := chunk.MutRowFromValues("tikv", "127.0.0.1:20161", "coprocessor.region-split-size", "10MB").ToRow() |
| 133 | rows = append(rows, row) |
| 134 | s := &mockRestrictedSQLExecutor{rows: rows, fields: fields} |
| 135 | require.Equal(t, utils.GetSplitSize(s), uint64(10000000)) |
| 136 | |
| 137 | rows = make([]chunk.Row, 0, 1) |
| 138 | row = chunk.MutRowFromValues("tikv", "127.0.0.1:20161", "coprocessor.region-split-keys", "100000").ToRow() |
| 139 | rows = append(rows, row) |
| 140 | s = &mockRestrictedSQLExecutor{rows: rows, fields: fields} |
| 141 | require.Equal(t, utils.GetSplitKeys(s), int64(100000)) |
| 142 | } |
nothing calls this directly
no test coverage detected