Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binlog-filter: add new event type #655

Merged
merged 15 commits into from
Jul 13, 2022
Prev Previous commit
Next Next commit
fix error
  • Loading branch information
asddongmen committed Jul 4, 2022
commit b794c00cf64cd97843a65a2e894206b62d395ca1
2 changes: 1 addition & 1 deletion pkg/binlog-filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ var ErrInvalidEventType = errors.New("event type not found")
func (b *BinlogEventRule) toEvent(es string) (EventType, error) {
event := EventType(strings.ToLower(es))
switch event {
case dml, ddl, AllEvent, AllDDL, AllDML,
case AllEvent, AllDDL, AllDML, NullEvent,
NoneEvent, NoneDDL, NoneDML,
InsertEvent, UpdateEvent, DeleteEvent,
CreateDatabase, DropDatabase, CreateTable,
Expand Down
12 changes: 7 additions & 5 deletions pkg/binlog-filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
package filter

import (
"testing"

"fmt"
. "github.com/pingcap/check"
selector "github.com/pingcap/tidb-tools/pkg/table-rule-selector"
"testing"
)

func TestClient(t *testing.T) {
Expand Down Expand Up @@ -268,9 +268,11 @@ func (t *testFilterSuite) TestToEvent(c *C) {
{"add column", AddColumn, nil},
{"drop column", DropColumn, nil},
}
br := &BinlogEventRule{}

for _, cs := range cases {
event, err := ToEvent(cs.eventStr)
c.Assert(event, Equals, cs.event)
c.Assert(err, Equals, cs.err)
event, err := br.toEvent(cs.eventStr)
c.Assert(cs.event, Equals, event)
c.Assert(cs.err, Equals, err)
}
}