Skip to content

Commit

Permalink
Merge pull request cockroachdb#96195 from ajwerner/backport22.2-93610
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwerner authored Jan 30, 2023
2 parents 1d755df + 8d2c523 commit 90f6e40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ go_library(
"@com_github_kr_pretty//:pretty",
"@com_github_lib_pq//:pq",
"@com_github_montanaflynn_stats//:stats",
"@com_github_pmezard_go_difflib//difflib",
"@com_github_prometheus_client_golang//api",
"@com_github_prometheus_client_golang//api/prometheus/v1:prometheus",
"@com_github_prometheus_common//model",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
"github.com/pmezard/go-difflib/difflib"
)

func registerValidateSystemSchemaAfterVersionUpgrade(r registry.Registry) {
Expand Down Expand Up @@ -85,8 +86,18 @@ func registerValidateSystemSchemaAfterVersionUpgrade(r registry.Registry) {
validateEquivalenceStep := func(str1, str2 *string) versionStep {
return func(ctx context.Context, t test.Test, u *versionUpgradeTest) {
if *str1 != *str2 {
t.Fatal("After upgrading, `USE system; SHOW CREATE ALL TABLES;` " +
"does not match expected output after version upgrade.\n")
diff, diffErr := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
A: difflib.SplitLines(*str1),
B: difflib.SplitLines(*str2),
Context: 5,
})
if diffErr != nil {
diff = diffErr.Error()
t.Errorf("failed to produce diff: %v", diffErr)
}
t.Fatalf("After upgrading, `USE system; SHOW CREATE ALL TABLES;` "+
"does not match expected output after version upgrade."+
"\nDiff:\n%s", diff)
}
t.L().Printf("validating succeeded:\n%v", *str1)
}
Expand Down

0 comments on commit 90f6e40

Please sign in to comment.