From e927865053d9341b2ce1bc715abe7c1ebef44fb6 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Mon, 7 Aug 2023 15:38:03 +0530 Subject: [PATCH] minor refactor Signed-off-by: Harshit Gangal --- go/test/endtoend/vtgate/foreignkey/main_test.go | 9 ++------- go/vt/sqlparser/ast_funcs.go | 4 ++-- go/vt/vtgate/planbuilder/plan_test.go | 2 +- .../testdata/{fk_cases.json => foreignkey_cases.json} | 0 4 files changed, 5 insertions(+), 10 deletions(-) rename go/vt/vtgate/planbuilder/testdata/{fk_cases.json => foreignkey_cases.json} (100%) diff --git a/go/test/endtoend/vtgate/foreignkey/main_test.go b/go/test/endtoend/vtgate/foreignkey/main_test.go index cf01ca37de0..eaeae4eeb9b 100644 --- a/go/test/endtoend/vtgate/foreignkey/main_test.go +++ b/go/test/endtoend/vtgate/foreignkey/main_test.go @@ -35,8 +35,8 @@ var ( clusterInstance *cluster.LocalProcessCluster vtParams mysql.ConnParams shardedKs = "ks" - shardedKsShards = []string{"-19a0", "19a0-20", "20-20c0", "20c0-"} Cell = "test" + //go:embed sharded_schema.sql shardedSchemaSQL string @@ -65,12 +65,7 @@ func TestMain(m *testing.M) { VSchema: shardedVSchema, } - err = clusterInstance.StartKeyspace(*sKs, shardedKsShards, 0, false) - if err != nil { - return 1 - } - - err = clusterInstance.VtctlclientProcess.ExecuteCommand("RebuildVSchemaGraph") + err = clusterInstance.StartKeyspace(*sKs, []string{"-80", "80-"}, 0, false) if err != nil { return 1 } diff --git a/go/vt/sqlparser/ast_funcs.go b/go/vt/sqlparser/ast_funcs.go index a88883339f4..3c8e917bb5d 100644 --- a/go/vt/sqlparser/ast_funcs.go +++ b/go/vt/sqlparser/ast_funcs.go @@ -2495,8 +2495,8 @@ func (ty KillType) ToString() string { } } -// Indexes returns true, -// if the list of columns contains all the elements in the other list provided along with their indexes. +// Indexes returns true, if the list of columns contains all the elements in the other list. +// It also returns the indexes of the columns in the list. func (cols Columns) Indexes(subSetCols Columns) (bool, []int) { var indexes []int for _, subSetCol := range subSetCols { diff --git a/go/vt/vtgate/planbuilder/plan_test.go b/go/vt/vtgate/planbuilder/plan_test.go index c15e7074190..c8cdfbf7a0a 100644 --- a/go/vt/vtgate/planbuilder/plan_test.go +++ b/go/vt/vtgate/planbuilder/plan_test.go @@ -112,7 +112,7 @@ func TestForeignKeyPlanning(t *testing.T) { } testOutputTempDir := makeTestOutput(t) - testFile(t, "fk_cases.json", testOutputTempDir, vschemaWrapper, false) + testFile(t, "foreignkey_cases.json", testOutputTempDir, vschemaWrapper, false) } func TestSystemTables57(t *testing.T) { diff --git a/go/vt/vtgate/planbuilder/testdata/fk_cases.json b/go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json similarity index 100% rename from go/vt/vtgate/planbuilder/testdata/fk_cases.json rename to go/vt/vtgate/planbuilder/testdata/foreignkey_cases.json