Skip to content

Commit

Permalink
fix tabletserver unit test
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 Feb 2, 2021
1 parent 91f9461 commit 2f61b5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 45 deletions.
32 changes: 0 additions & 32 deletions go/vt/vttablet/tabletserver/planbuilder/testdata/exec_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -595,38 +595,6 @@ options:PassthroughDMLs
"FullQuery": "delete from a limit 10"
}

# int
"set a=1"
{
"PlanID": "Set",
"TableName": "",
"FullQuery": "set a = 1"
}

# float
"set a=1.2"
{
"PlanID": "Set",
"TableName": "",
"FullQuery": "set a = 1.2"
}

# string
"set a='b'"
{
"PlanID": "Set",
"TableName": "",
"FullQuery": "set a = 'b'"
}

# multi
"set a=1, b=2"
{
"PlanID": "Set",
"TableName": "",
"FullQuery": "set a = 1, b = 2"
}

# create
"create table a(a int, b varchar(8))"
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,13 @@
"release_lock('foo') not allowed without a reserved connections"

# setting system variables must happen inside reserved connections
"set @sql_safe_updates = false"
"set @sql_safe_updates = false not allowed without a reserved connections"
"set sql_safe_updates = false"
"set sql_safe_updates = false not allowed without a reserved connections"

# setting system variables must happen inside reserved connections
"set @@sql_safe_updates = false"
"set @@sql_safe_updates = false not allowed without a reserved connections"

# setting system variables must happen inside reserved connections
"set @udv = false"
"set @udv = false not allowed without a reserved connections"
13 changes: 2 additions & 11 deletions go/vt/vttablet/tabletserver/query_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ func TestQueryExecutorPlans(t *testing.T) {
// Because the fields would have been cached before, the field query will
// not get re-executed.
inTxWant: "select * from t limit 1",
}, {
input: "set a=1",
dbResponses: []dbResponse{{
query: "set a=1",
result: dmlResult,
}},
resultWant: dmlResult,
planWant: "Set",
logWant: "set a=1",
}, {
input: "show engines",
dbResponses: []dbResponse{{
Expand Down Expand Up @@ -262,7 +253,7 @@ func TestQueryExecutorPlans(t *testing.T) {
inTxWant: "RELEASE savepoint a",
}}
for _, tcase := range testcases {
func() {
t.Run(tcase.input, func(t *testing.T) {
db := setUpQueryExecutorTest(t)
defer db.Close()
for _, dbr := range tcase.dbResponses {
Expand Down Expand Up @@ -300,7 +291,7 @@ func TestQueryExecutorPlans(t *testing.T) {
want = tcase.inTxWant
}
assert.Equal(t, want, qre.logStats.RewrittenSQL(), "in tx: %v", tcase.input)
}()
})
}
}

Expand Down

0 comments on commit 2f61b5c

Please sign in to comment.