Skip to content

Commit

Permalink
Merge #97577
Browse files Browse the repository at this point in the history
97577: sql: skip mixed version test if setup stmt is unimplemented in old version r=chengxiong-ruan a=chengxiong-ruan

This patch add additional error checking so that we can skip a test if the any of the setup statement is unimplemented. This is useful to skip a mixed version schema changer test when implementing new features which are version gated.

Epic: None

Release note: None

Co-authored-by: Chengxiong Ruan <[email protected]>
  • Loading branch information
craig[bot] and chengxiong-ruan committed Feb 24, 2023
2 parents f3796ef + 49b5ecd commit c0b2a17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/sql/schemachanger/sctest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ go_library(
"//pkg/sql",
"//pkg/sql/catalog",
"//pkg/sql/parser",
"//pkg/sql/pgwire/pgcode",
"//pkg/sql/schemachanger/corpus",
"//pkg/sql/schemachanger/scbuild",
"//pkg/sql/schemachanger/scdecomp",
Expand Down
13 changes: 12 additions & 1 deletion pkg/sql/schemachanger/sctest/cumulative.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/kv/kvpb"
"github.com/cockroachdb/cockroach/pkg/sql/catalog"
"github.com/cockroachdb/cockroach/pkg/sql/parser"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/schemachanger/corpus"
"github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scbuild"
"github.com/cockroachdb/cockroach/pkg/sql/schemachanger/scexec"
Expand Down Expand Up @@ -1391,7 +1392,17 @@ func executeSchemaChangeTxn(
// declarative schema changer testing knobs don't get used.
tdb.Exec(t, "SET use_declarative_schema_changer = 'off'")
for _, stmt := range setup {
tdb.Exec(t, stmt.SQL)
_, err := db.Exec(stmt.SQL)
if err != nil {
// nolint:errcmp
switch errT := err.(type) {
case *pq.Error:
if string(errT.Code) == pgcode.FeatureNotSupported.String() {
skip.IgnoreLint(t, "skipping due to unimplemented feature in old cluster version.")
}
}
return err
}
}
waitForSchemaChangesToFinish(t, tdb)
if before != nil {
Expand Down

0 comments on commit c0b2a17

Please sign in to comment.