Skip to content

Commit

Permalink
test: normalize collation errors (vitessio#10842)
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <[email protected]>

Co-authored-by: Manan Gupta <[email protected]>
  • Loading branch information
vitess-bot[bot] and GuptaManan100 authored Jul 26, 2022
1 parent efb4708 commit 0cb2a1d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion go/mysql/collations/integration/coercion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func TestComparisonSemantics(t *testing.T) {
t.Errorf("expected %s vs %s to fail coercion: %v", collA.Collation.Name(), collB.Collation.Name(), errRemote)
continue
}
if !strings.HasPrefix(errRemote.Error(), errLocal.Error()) {
if !strings.HasPrefix(normalizeCollationInError(errRemote.Error()), normalizeCollationInError(errLocal.Error())) {
t.Fatalf("bad error message: expected %q, got %q", errRemote, errLocal)
}
continue
Expand All @@ -225,3 +225,13 @@ func TestComparisonSemantics(t *testing.T) {
})
}
}

// normalizeCollationInError normalizes the collation name in the error output.
// Starting with mysql 8.0.30 collations prefixed with `utf8_` have been changed to use `utf8mb3_` instead
// This is inconsistent with older MySQL versions and causes the tests to fail against it.
// As a stop-gap solution, this functions normalizes the error messages so that the tests pass until we
// have a fix for it.
// TODO: Remove error normalization
func normalizeCollationInError(errMessage string) string {
return strings.ReplaceAll(errMessage, "utf8_", "utf8mb3_")
}

0 comments on commit 0cb2a1d

Please sign in to comment.