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

dm: refine instrunction #8556

Merged
merged 2 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dm/pkg/checker/table_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ func (c *TablesChecker) handleOpts(r *Result) (func(options []*incompatibilityOp
}
}
}, func() {
instructionSlice := make([]string, 0, len(resultInstructions))
for k := range resultInstructions {
r.Instruction += k + "; "
instructionSlice = append(instructionSlice, k)
}
r.Instruction += strings.Join(instructionSlice, "; ")
}
}

Expand Down
4 changes: 4 additions & 0 deletions dm/pkg/checker/table_structure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package checker

import (
"context"
"strings"
"testing"

"github.com/DATA-DOG/go-sqlmock"
Expand Down Expand Up @@ -217,6 +218,7 @@ func TestTablesChecker(t *testing.T) {
require.Len(t, result.Errors, 2)
require.NoError(t, mock.ExpectationsWereMet())
require.NoError(t, downMock.ExpectationsWereMet())
require.False(t, strings.HasSuffix(result.Instruction, "; "))

// 3. test #5759

Expand Down Expand Up @@ -311,6 +313,7 @@ func TestTablesChecker(t *testing.T) {
result.Errors[4].ShortErr)
require.NoError(t, mock.ExpectationsWereMet())
require.NoError(t, downMock.ExpectationsWereMet())
require.False(t, strings.HasSuffix(result.Instruction, "; "))

// 5. check extended columns
commonMock()
Expand Down Expand Up @@ -346,6 +349,7 @@ func TestTablesChecker(t *testing.T) {
result = checker.Check(ctx)
require.Equal(t, StateFailure, result.State)
require.Len(t, result.Errors, 2)
require.False(t, strings.HasSuffix(result.Instruction, "; "))
require.Equal(t,
"table `test-db`.`test-table-1` upstream table must not contain extended column [ext1]",
result.Errors[0].ShortErr)
Expand Down