Skip to content

Commit

Permalink
updated e2e test ot use target destination
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Aug 12, 2020
1 parent e3bc6ad commit 59612dd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/test/endtoend/vtgate/lookup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestDMLScatter(t *testing.T) {
3 4
4 5
*/
exec(t, conn, "update t3 set id5 = 42 where id5 = 1")
exec(t, conn, "update `ks[-]`.t3 set id5 = 42 where id5 = 1")
qr = exec(t, conn, "select id5, id6, id7 from t3 order by id5")
if got, want := fmt.Sprintf("%v", qr.Rows), "[[INT64(2) INT64(2) INT64(3)] [INT64(3) INT64(4) INT64(3)] [INT64(4) INT64(5) INT64(4)] [INT64(42) INT64(2) INT64(3)]]"; got != want {
t.Errorf("select:\n%v want\n%v", got, want)
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestDMLScatter(t *testing.T) {
require.Empty(t, qr.Rows)

// delete all the rows.
exec(t, conn, "delete from t3")
exec(t, conn, "delete from `ks[-]`.t3")
qr = exec(t, conn, "select * from t3")
require.Empty(t, qr.Rows)
qr = exec(t, conn, "select * from t3_id7_idx")
Expand Down
19 changes: 19 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/dml_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2146,3 +2146,22 @@
"Table": "user"
}
}

# update with shard targeting without vindex
"update `user[-]`.user_extra set val = 1"
{
"QueryType": "UPDATE",
"Original": "update `user[-]`.user_extra set val = 1",
"Instructions": {
"OperatorType": "Update",
"Variant": "ByDestination",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"TargetTabletType": "MASTER",
"MultiShardAutocommit": false,
"Query": "update user_extra set val = 1",
"Table": "user_extra"
}
}

0 comments on commit 59612dd

Please sign in to comment.