From 59612ddd78c54bd6c73d048385592bc5718cd8f1 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Wed, 12 Aug 2020 19:31:38 +0530 Subject: [PATCH] updated e2e test ot use target destination Signed-off-by: Harshit Gangal --- go/test/endtoend/vtgate/lookup_test.go | 4 ++-- .../vtgate/planbuilder/testdata/dml_cases.txt | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/go/test/endtoend/vtgate/lookup_test.go b/go/test/endtoend/vtgate/lookup_test.go index a5b485399c0..ffc019073be 100644 --- a/go/test/endtoend/vtgate/lookup_test.go +++ b/go/test/endtoend/vtgate/lookup_test.go @@ -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) @@ -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") diff --git a/go/vt/vtgate/planbuilder/testdata/dml_cases.txt b/go/vt/vtgate/planbuilder/testdata/dml_cases.txt index 9158fc72b5b..1edb0c69d62 100644 --- a/go/vt/vtgate/planbuilder/testdata/dml_cases.txt +++ b/go/vt/vtgate/planbuilder/testdata/dml_cases.txt @@ -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" + } +}