Skip to content

Commit

Permalink
Fix the fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nickschuch committed Aug 30, 2024
1 parent a1df6fe commit 4663d2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions internal/mysql/provider/stdout/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ func TestMySQLGetSelectQueryFor(t *testing.T) {
func TestMySQLGetSelectQueryForHandlingError(t *testing.T) {
db, mock := mock.GetDB(t)
dumper := NewClient(db, log.New(os.Stdout, "", 0))
error := errors.New("broken")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(error)
e := errors.New("broken")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(e)
query, err := dumper.GetSelectQueryForTable("table", provider.DumpParams{
SelectMap: map[string]map[string]string{"table": {"c2": "NOW()"}},
WhereMap: map[string]string{"table": "c1 > 0"},
})
assert.Equal(t, error, err)
assert.Equal(t, e, err)
assert.Equal(t, "", query)
}
6 changes: 3 additions & 3 deletions internal/mysql/provider/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ func TestMySQLGetColumnsForSelect(t *testing.T) {

func TestMySQLGetColumnsForSelectHandlingErrorWhenQuerying(t *testing.T) {
db, mock := mock.GetDB(t)
error := errors.New("broken")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(error)
e := errors.New("broken")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(e)
columns, err := QueryColumnsForTable(db, "table", provider.DumpParams{
SelectMap: map[string]map[string]string{"table": {"col2": "NOW()"}},
})
assert.Equal(t, err, error)
assert.Equal(t, err, e)
assert.Empty(t, columns)
}
6 changes: 3 additions & 3 deletions internal/mysql/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestMySQLDumpTableDataHandlingErrorFromSelectAllDataFor(t *testing.T) {
db, mock := mock.GetDB(t)
buffer := bytes.NewBuffer(make([]byte, 0))
dumper := NewClient(db, log.New(os.Stdout, "", 0), "stdout", "", "")
error := errors.New("fail")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(error)
assert.Equal(t, error, dumper.WriteTableData(buffer, "table", provider.DumpParams{}))
e := errors.New("fail")
mock.ExpectQuery("SELECT \\* FROM `table` LIMIT 1").WillReturnError(e)
assert.Equal(t, e, dumper.WriteTableData(buffer, "table", provider.DumpParams{}))
}

0 comments on commit 4663d2e

Please sign in to comment.