Skip to content

Commit

Permalink
feat: fix testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
earayu committed Nov 24, 2024
1 parent 5a194a5 commit ea3bfaa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions go/vt/vttablet/tabletserver/query_executor_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ func TestQueryExecutor_runActionListBeforeExecution(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
qre := &QueryExecutor{ctx: ctx}
db := setUpQueryExecutorTest(t)
defer db.Close()
tsv := newTestTabletServer(ctx, noFlags, db)
qre := newTestQueryExecutor(ctx, tsv, "select 1", 0)
qre.matchedActionList = tt.actionList
_, err := qre.runActionListBeforeExecution()
tt.wantErr(t, err, "runActionListBeforeExecution()")
Expand Down Expand Up @@ -129,7 +132,10 @@ func TestQueryExecutor_runActionListAfterExecution(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
qre := &QueryExecutor{ctx: ctx}
db := setUpQueryExecutorTest(t)
defer db.Close()
tsv := newTestTabletServer(ctx, noFlags, db)
qre := newTestQueryExecutor(ctx, tsv, "select 1", 0)
qre.matchedActionList = tt.actionList
qr := &sqltypes.Result{}
var err error
Expand Down Expand Up @@ -162,7 +168,10 @@ func TestQueryExecutor_actions_can_be_skipped(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
qre := &QueryExecutor{ctx: ctx}
db := setUpQueryExecutorTest(t)
defer db.Close()
tsv := newTestTabletServer(ctx, noFlags, db)
qre := newTestQueryExecutor(ctx, tsv, "select 1", 0)
qre.matchedActionList = tt.actionList
qr, err := qre.runActionListBeforeExecution()
tt.wantErr(t, err, "runActionListBeforeExecution()")
Expand Down

0 comments on commit ea3bfaa

Please sign in to comment.