From 4663d2e2758a8ceeab09534d1b345bffdd2cd18f Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Fri, 30 Aug 2024 12:39:09 +1000 Subject: [PATCH] Fix the fails --- internal/mysql/provider/stdout/provider_test.go | 6 +++--- internal/mysql/provider/utils/utils_test.go | 6 +++--- internal/mysql/write_test.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/mysql/provider/stdout/provider_test.go b/internal/mysql/provider/stdout/provider_test.go index d8b6e50..e7ca599 100644 --- a/internal/mysql/provider/stdout/provider_test.go +++ b/internal/mysql/provider/stdout/provider_test.go @@ -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) } diff --git a/internal/mysql/provider/utils/utils_test.go b/internal/mysql/provider/utils/utils_test.go index 7a0bc8d..f2e85b2 100644 --- a/internal/mysql/provider/utils/utils_test.go +++ b/internal/mysql/provider/utils/utils_test.go @@ -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) } diff --git a/internal/mysql/write_test.go b/internal/mysql/write_test.go index c5f048b..62c014d 100644 --- a/internal/mysql/write_test.go +++ b/internal/mysql/write_test.go @@ -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{})) }