Skip to content

Commit

Permalink
fix executor set test
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Jul 24, 2020
1 parent a80e7f1 commit e63dcb7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions go/vt/vtgate/executor_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ func TestExecutorSet(t *testing.T) {
executorEnv, _, _, _ := createExecutorEnv()

testcases := []struct {
in string
out *vtgatepb.Session
err string
in string
out *vtgatepb.Session
err string
target string
}{{
in: "set autocommit = 1",
out: &vtgatepb.Session{Autocommit: true},
Expand Down Expand Up @@ -237,11 +238,13 @@ func TestExecutorSet(t *testing.T) {
in: "set skip_query_plan_cache = 0",
out: &vtgatepb.Session{Autocommit: true, Options: &querypb.ExecuteOptions{}},
}, {
in: "set sql_auto_is_null = 0",
out: &vtgatepb.Session{Autocommit: true, RowCount: -1},
in: "set sql_auto_is_null = 0",
target: "TestExecutor",
out: &vtgatepb.Session{Autocommit: true, TargetString: "TestExecutor"},
}, {
in: "set sql_auto_is_null = 1",
out: &vtgatepb.Session{Autocommit: true, RowCount: -1},
in: "set sql_auto_is_null = 1",
target: "TestExecutor",
out: &vtgatepb.Session{Autocommit: true, TargetString: "TestExecutor"},
}, {
in: "set tx_read_only = 2",
err: "unexpected value for tx_read_only: 2",
Expand Down Expand Up @@ -287,7 +290,7 @@ func TestExecutorSet(t *testing.T) {
}}
for _, tcase := range testcases {
t.Run(tcase.in, func(t *testing.T) {
session := NewSafeSession(&vtgatepb.Session{Autocommit: true})
session := NewSafeSession(&vtgatepb.Session{Autocommit: true, TargetString: tcase.target})
_, err := executorEnv.Execute(context.Background(), "TestExecute", session, tcase.in, nil)
if tcase.err == "" {
utils.MustMatch(t, tcase.out, session.Session, "new executor")
Expand Down

0 comments on commit e63dcb7

Please sign in to comment.