@@ -63,7 +63,7 @@ create table t1(
63
63
` ,
64
64
}
65
65
66
- func setupLookupIndexKeyspace (t * testing.T ) map [string ]* cluster.VttabletProcess {
66
+ func setupLookupVindexKeyspace (t * testing.T ) map [string ]* cluster.VttabletProcess {
67
67
tablets := make (map [string ]* cluster.VttabletProcess )
68
68
if _ , err := vc .AddKeyspace (t , []* Cell {vc .Cells ["zone1" ]}, lookupClusterSpec .keyspaceName , "-80,80-" ,
69
69
lookupClusterSpec .vschema , lookupClusterSpec .schema , defaultReplicas , defaultRdonly , 200 , nil ); err != nil {
@@ -80,14 +80,14 @@ func setupLookupIndexKeyspace(t *testing.T) map[string]*cluster.VttabletProcess
80
80
81
81
type lookupTestCase struct {
82
82
name string
83
- li * lookupIndex
83
+ lv * lookupVindex
84
84
initQuery string
85
85
runningQuery string
86
86
postExternalizeQuery string
87
87
cleanupQuery string
88
88
}
89
89
90
- func TestLookupIndex (t * testing.T ) {
90
+ func TestLookupVindex (t * testing.T ) {
91
91
setSidecarDBName ("_vt" )
92
92
origDefaultReplicas := defaultReplicas
93
93
origDefaultRdonly := defaultRdonly
@@ -101,7 +101,7 @@ func TestLookupIndex(t *testing.T) {
101
101
defer vc .TearDown ()
102
102
vttablet .InitVReplicationConfigDefaults ()
103
103
104
- _ = setupLookupIndexKeyspace (t )
104
+ _ = setupLookupVindexKeyspace (t )
105
105
106
106
initQuery := "insert into t1 (c1, c2, val) values (1, 1, 'val1'), (2, 2, 'val2'), (3, 3, 'val3')"
107
107
runningQuery := "insert into t1 (c1, c2, val) values (4, 4, 'val4'), (5, 5, 'val5'), (6, 6, 'val6')"
@@ -111,7 +111,7 @@ func TestLookupIndex(t *testing.T) {
111
111
testCases := []lookupTestCase {
112
112
{
113
113
name : "non-unique lookup index, one column" ,
114
- li : & lookupIndex {
114
+ lv : & lookupVindex {
115
115
typ : "consistent_lookup" ,
116
116
name : "t1_c2_lookup" ,
117
117
tableKeyspace : lookupClusterSpec .keyspaceName ,
@@ -125,7 +125,7 @@ func TestLookupIndex(t *testing.T) {
125
125
},
126
126
{
127
127
name : "lookup index, two columns" ,
128
- li : & lookupIndex {
128
+ lv : & lookupVindex {
129
129
typ : "lookup" ,
130
130
name : "t1_c2_val_lookup" ,
131
131
tableKeyspace : lookupClusterSpec .keyspaceName ,
@@ -139,7 +139,7 @@ func TestLookupIndex(t *testing.T) {
139
139
},
140
140
{
141
141
name : "unique lookup index, one column" ,
142
- li : & lookupIndex {
142
+ lv : & lookupVindex {
143
143
typ : "lookup_unique" ,
144
144
name : "t1_c2_unique_lookup" ,
145
145
tableKeyspace : lookupClusterSpec .keyspaceName ,
@@ -168,7 +168,7 @@ func testLookupVindex(t *testing.T, tc *lookupTestCase) {
168
168
vtgateConn , cancel := getVTGateConn ()
169
169
defer cancel ()
170
170
var totalRows int
171
- li := tc .li
171
+ lv := tc .lv
172
172
173
173
t .Run ("init data" , func (t * testing.T ) {
174
174
totalRows += getNumRowsInQuery (t , tc .initQuery )
@@ -177,28 +177,28 @@ func testLookupVindex(t *testing.T, tc *lookupTestCase) {
177
177
})
178
178
179
179
t .Run ("create" , func (t * testing.T ) {
180
- tc .li .create ()
180
+ tc .lv .create ()
181
181
182
- lks := li .tableKeyspace
183
- vindexName := li .name
182
+ lks := lv .tableKeyspace
183
+ vindexName := lv .name
184
184
waitForRowCount (t , vtgateConn , lks , vindexName , totalRows )
185
185
totalRows += getNumRowsInQuery (t , tc .runningQuery )
186
186
_ , err := vtgateConn .ExecuteFetch (tc .runningQuery , 1000 , false )
187
187
require .NoError (t , err )
188
- waitForRowCount (t , vtgateConn , tc .li .ownerTableKeyspace , li .name , totalRows )
188
+ waitForRowCount (t , vtgateConn , tc .lv .ownerTableKeyspace , lv .name , totalRows )
189
189
})
190
190
191
191
t .Run ("externalize" , func (t * testing.T ) {
192
- tc .li .externalize ()
192
+ tc .lv .externalize ()
193
193
totalRows += getNumRowsInQuery (t , tc .postExternalizeQuery )
194
194
_ , err := vtgateConn .ExecuteFetch (tc .postExternalizeQuery , 1000 , false )
195
195
require .NoError (t , err )
196
- waitForRowCount (t , vtgateConn , tc .li .ownerTableKeyspace , li .name , totalRows )
196
+ waitForRowCount (t , vtgateConn , tc .lv .ownerTableKeyspace , lv .name , totalRows )
197
197
})
198
198
199
199
t .Run ("cleanup" , func (t * testing.T ) {
200
200
_ , err := vtgateConn .ExecuteFetch (tc .cleanupQuery , 1000 , false )
201
201
require .NoError (t , err )
202
- waitForRowCount (t , vtgateConn , tc .li .ownerTableKeyspace , li .name , 0 )
202
+ waitForRowCount (t , vtgateConn , tc .lv .ownerTableKeyspace , lv .name , 0 )
203
203
})
204
204
}
0 commit comments