@@ -31,15 +31,15 @@ func insertInitialData(t *testing.T) {
3131 defer closeConn ()
3232 log .Infof ("Inserting initial data" )
3333 lines , _ := os .ReadFile ("unsharded_init_data.sql" )
34- execMultipleQueries (t , vtgateConn , "product :0" , string (lines ))
35- execVtgateQuery (t , vtgateConn , "product :0" , "insert into customer_seq(id, next_id, cache) values(0, 100, 100);" )
36- execVtgateQuery (t , vtgateConn , "product :0" , "insert into order_seq(id, next_id, cache) values(0, 100, 100);" )
37- execVtgateQuery (t , vtgateConn , "product :0" , "insert into customer_seq2(id, next_id, cache) values(0, 100, 100);" )
34+ execMultipleQueries (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , string (lines ))
35+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into customer_seq(id, next_id, cache) values(0, 100, 100);" )
36+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into order_seq(id, next_id, cache) values(0, 100, 100);" )
37+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into customer_seq2(id, next_id, cache) values(0, 100, 100);" )
3838 log .Infof ("Done inserting initial data" )
3939
40- waitForRowCount (t , vtgateConn , "product :0" , "product" , 2 )
41- waitForRowCount (t , vtgateConn , "product :0" , "customer" , 3 )
42- waitForQueryResult (t , vtgateConn , "product :0" , "select * from merchant" ,
40+ waitForRowCount (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "product" , 2 )
41+ waitForRowCount (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "customer" , 3 )
42+ waitForQueryResult (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "select * from merchant" ,
4343 `[[VARCHAR("Monoprice") VARCHAR("eléctronics")] [VARCHAR("newegg") VARCHAR("elec†ronics")]]` )
4444
4545 insertJSONValues (t )
@@ -52,12 +52,12 @@ func insertJSONValues(t *testing.T) {
5252 // insert null value combinations
5353 vtgateConn , closeConn := getVTGateConn ()
5454 defer closeConn ()
55- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j3) values(1, \" {}\" )" )
56- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j1, j3) values(2, \" {}\" , \" {}\" )" )
57- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j2, j3) values(3, \" {}\" , \" {}\" )" )
58- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j1, j2, j3) values(4, NULL, 'null', '\" null\" ')" )
59- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j3) values(5, JSON_QUOTE('null'))" )
60- execVtgateQuery (t , vtgateConn , "product :0" , "insert into json_tbl(id, j3) values(6, '{}')" )
55+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j3) values(1, \" {}\" )" )
56+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j1, j3) values(2, \" {}\" , \" {}\" )" )
57+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j2, j3) values(3, \" {}\" , \" {}\" )" )
58+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j1, j2, j3) values(4, NULL, 'null', '\" null\" ')" )
59+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j3) values(5, JSON_QUOTE('null'))" )
60+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , "insert into json_tbl(id, j3) values(6, '{}')" )
6161
6262 id := 8 // 6 inserted above and one after copy phase is done
6363
@@ -68,7 +68,7 @@ func insertJSONValues(t *testing.T) {
6868 j1 := rand .IntN (numJsonValues )
6969 j2 := rand .IntN (numJsonValues )
7070 query := fmt .Sprintf (q , id , jsonValues [j1 ], jsonValues [j2 ])
71- execVtgateQuery (t , vtgateConn , "product :0" , query )
71+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , query )
7272 }
7373}
7474
@@ -82,7 +82,7 @@ func insertMoreCustomers(t *testing.T, numCustomers int) {
8282 // that we reserved.
8383 vtgateConn , closeConn := getVTGateConn ()
8484 defer closeConn ()
85- maxID := waitForSequenceValue (t , vtgateConn , "product" , "customer_seq" , numCustomers )
85+ maxID := waitForSequenceValue (t , vtgateConn , defaultSourceKs , "customer_seq" , numCustomers )
8686 // So we need to calculate the first value we reserved
8787 // from the max.
8888 cid := maxID - int64 (numCustomers )
@@ -97,28 +97,28 @@ func insertMoreCustomers(t *testing.T, numCustomers int) {
9797 }
9898 cid ++
9999 }
100- execVtgateQuery (t , vtgateConn , "customer" , sql )
100+ execVtgateQuery (t , vtgateConn , defaultTargetKs , sql )
101101}
102102
103103func insertMoreProducts (t * testing.T ) {
104104 vtgateConn , closeConn := getVTGateConn ()
105105 defer closeConn ()
106106 sql := "insert into product(pid, description) values(3, 'cpu'),(4, 'camera'),(5, 'mouse');"
107- execVtgateQuery (t , vtgateConn , "product" , sql )
107+ execVtgateQuery (t , vtgateConn , defaultSourceKs , sql )
108108}
109109
110110func insertMoreProductsForSourceThrottler (t * testing.T ) {
111111 vtgateConn , closeConn := getVTGateConn ()
112112 defer closeConn ()
113113 sql := "insert into product(pid, description) values(103, 'new-cpu'),(104, 'new-camera'),(105, 'new-mouse');"
114- execVtgateQuery (t , vtgateConn , "product" , sql )
114+ execVtgateQuery (t , vtgateConn , defaultSourceKs , sql )
115115}
116116
117117func insertMoreProductsForTargetThrottler (t * testing.T ) {
118118 vtgateConn , closeConn := getVTGateConn ()
119119 defer closeConn ()
120120 sql := "insert into product(pid, description) values(203, 'new-cpu'),(204, 'new-camera'),(205, 'new-mouse');"
121- execVtgateQuery (t , vtgateConn , "product" , sql )
121+ execVtgateQuery (t , vtgateConn , defaultSourceKs , sql )
122122}
123123
124124var blobTableQueries = []string {
@@ -137,6 +137,6 @@ func insertIntoBlobTable(t *testing.T) {
137137 vtgateConn , closeConn := getVTGateConn ()
138138 defer closeConn ()
139139 for _ , query := range blobTableQueries {
140- execVtgateQuery (t , vtgateConn , "product :0" , query )
140+ execVtgateQuery (t , vtgateConn , fmt . Sprintf ( "%s :0", defaultSourceKs ) , query )
141141 }
142142}
0 commit comments