Decouple slave connection and reader

This commit is contained in:
2018-11-11 15:26:40 +01:00
parent 8c8705581e
commit 6f61469eea
4 changed files with 35 additions and 39 deletions
+3 -7
View File
@@ -11,6 +11,7 @@ import (
"github.com/localhots/bocadillo/binlog"
"github.com/localhots/bocadillo/reader"
"github.com/localhots/bocadillo/reader/slave"
)
var suite *testSuite
@@ -30,12 +31,7 @@ func TestMain(m *testing.M) {
conf.Offset = uint32(pos.Offset)
}
slaveConn, err := reader.Connect(dsn, conf)
if err != nil {
log.Fatal(err)
}
rdr, err := reader.NewReader(slaveConn)
rdr, err := reader.New(dsn, conf)
if err != nil {
log.Fatal(err)
}
@@ -50,7 +46,7 @@ func TestMain(m *testing.M) {
os.Exit(exitCode)
}
func getConfig() (dsn string, conf reader.Config) {
func getConfig() (dsn string, conf slave.Config) {
envOrDefault := func(name, def string) string {
if val := os.Getenv(name); val != "" {
return val