Skip to content

Commit

Permalink
test: Add more tests in vstreamer_test.go
Browse files Browse the repository at this point in the history
Signed-off-by: Noble Mittal <[email protected]>
  • Loading branch information
beingnoble03 committed Nov 29, 2024
1 parent e408edd commit b30a8ba
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions go/vt/vttablet/tabletserver/vstreamer/vstreamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ func TestFilteredMultipleWhere(t *testing.T) {
filter: &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "t1",
Filter: "select id1, val from t1 where in_keyrange('-80') and id2 = 200 and id3 = 1000 and val = 'newton'",
Filter: "select id1, val from t1 where in_keyrange('-80') and id2 = 200 and id3 = 1000 and val = 'newton' and id1 in (1, 2, 129)",
}},
},
customFieldEvents: true,
Expand All @@ -1988,9 +1988,7 @@ func TestFilteredMultipleWhere(t *testing.T) {
{spec: &TestRowEventSpec{table: "t1", changes: []TestRowChange{{after: []string{"2", "newton"}}}}},
}},
{"insert into t1 values (3, 100, 2000, 'kepler')", noEvents},
{"insert into t1 values (128, 200, 1000, 'newton')", []TestRowEvent{
{spec: &TestRowEventSpec{table: "t1", changes: []TestRowChange{{after: []string{"128", "newton"}}}}},
}},
{"insert into t1 values (128, 200, 1000, 'newton')", noEvents},
{"insert into t1 values (5, 200, 2000, 'kepler')", noEvents},
{"insert into t1 values (129, 200, 1000, 'kepler')", noEvents},
{"commit", nil},
Expand Down Expand Up @@ -2080,3 +2078,33 @@ func TestGeneratedInvisiblePrimaryKey(t *testing.T) {
}}
ts.Run()
}

func TestFilteredInOperator(t *testing.T) {
ts := &TestSpec{
t: t,
ddls: []string{
"create table t1(id1 int, id2 int, val varbinary(128), primary key(id1))",
},
options: &TestSpecOptions{
filter: &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "t1",
Filter: "select id1, val from t1 where val in ('eee', 'bbb', 'ddd')",
}},
},
},
}
defer ts.Close()
ts.Init()
ts.fieldEvents["t1"].cols[1].skip = true
ts.tests = [][]*TestQuery{{
{"begin", nil},
{"insert into t1 values (1, 100, 'aaa')", noEvents},
{"insert into t1 values (2, 200, 'bbb')", nil},
{"insert into t1 values (3, 100, 'ccc')", noEvents},
{"insert into t1 values (4, 200, 'ddd')", nil},
{"insert into t1 values (5, 200, 'eee')", nil},
{"commit", nil},
}}
ts.Run()
}

0 comments on commit b30a8ba

Please sign in to comment.