Skip to content

Commit

Permalink
logictest: support mixed binary version tests with upgrades
Browse files Browse the repository at this point in the history
The logictest framework can now use the cockroach-go testserver to test
a multi-node cluster in which each node is running a different binary
version.

Previously, only mixed logical versions could be tested.

Release note: None
  • Loading branch information
rafiss committed Nov 23, 2022
1 parent 0390d01 commit 8550794
Show file tree
Hide file tree
Showing 12 changed files with 536 additions and 42 deletions.
6 changes: 6 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ ALL_TESTS = [
"//pkg/sql/lexbase:lexbase_test",
"//pkg/sql/logictest/tests/5node-disk:5node-disk_test",
"//pkg/sql/logictest/tests/5node:5node_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.1-22.2:cockroach-go-testserver-22_1-22_2_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.2-master:cockroach-go-testserver-22_2-master_test",
"//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test",
"//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test",
"//pkg/sql/logictest/tests/fakedist:fakedist_test",
Expand Down Expand Up @@ -1542,6 +1544,8 @@ GO_TARGETS = [
"//pkg/sql/logictest/logictestbase:logictestbase",
"//pkg/sql/logictest/tests/5node-disk:5node-disk_test",
"//pkg/sql/logictest/tests/5node:5node_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.1-22.2:cockroach-go-testserver-22_1-22_2_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.2-master:cockroach-go-testserver-22_2-master_test",
"//pkg/sql/logictest/tests/fakedist-disk:fakedist-disk_test",
"//pkg/sql/logictest/tests/fakedist-vec-off:fakedist-vec-off_test",
"//pkg/sql/logictest/tests/fakedist:fakedist_test",
Expand Down Expand Up @@ -2721,6 +2725,8 @@ GET_X_DATA_TARGETS = [
"//pkg/sql/logictest/logictestbase:get_x_data",
"//pkg/sql/logictest/tests/5node:get_x_data",
"//pkg/sql/logictest/tests/5node-disk:get_x_data",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.1-22.2:get_x_data",
"//pkg/sql/logictest/tests/cockroach-go-testserver-22.2-master:get_x_data",
"//pkg/sql/logictest/tests/fakedist:get_x_data",
"//pkg/sql/logictest/tests/fakedist-disk:get_x_data",
"//pkg/sql/logictest/tests/fakedist-vec-off:get_x_data",
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/generate-logictest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type testFileTemplateConfig struct {
CclLogicTest bool
ExecBuildLogicTest bool
SqliteLogicTest bool
CockroachGoTestserverTest bool
Ccl bool
ForceProductionValues bool
Package, TestRuleName, RelDir string
Expand Down Expand Up @@ -160,6 +161,7 @@ func (t *testdir) dump() error {
tplCfg.Package = strings.ReplaceAll(strings.ReplaceAll(cfg.Name, "-", "_"), ".", "")
tplCfg.RelDir = t.relPathToParent
tplCfg.TestCount = testCount
tplCfg.CockroachGoTestserverTest = cfg.UseCockroachGoTestserver
// The NumCPU calculation is a guess pulled out of thin air to
// allocate the tests which use 3-node clusters 2 vCPUs, and
// the ones which use more a bit more.
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/generate-logictest/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ go_test(
args = ["-test.timeout=3595s"],{{ end }}
data = [
"//c-deps:libgeos", # keep{{ if .SqliteLogicTest }}
"@com_github_cockroachdb_sqllogictest//:testfiles", # keep{{ end }}{{ if .CclLogicTest }}
"@com_github_cockroachdb_sqllogictest//:testfiles", # keep{{ end }}{{ if .CockroachGoTestserverTest }}
"//pkg/cmd/cockroach-short", # keep{{ end }}{{ if .CclLogicTest }}
"//pkg/ccl/logictestccl:testdata", # keep{{ end }}{{ if .LogicTest }}
"//pkg/sql/logictest:testdata", # keep{{ end }}{{ if .ExecBuildLogicTest }}
"//pkg/sql/opt/exec/execbuilder:testdata", # keep{{ end }}
Expand Down
2 changes: 2 additions & 0 deletions pkg/sql/logictest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/base",
"//pkg/build/bazel",
"//pkg/cloud/externalconn/providers",
"//pkg/clusterversion",
"//pkg/col/coldata",
Expand Down Expand Up @@ -60,6 +61,7 @@ go_library(
"//pkg/testutils/sqlutils",
"//pkg/upgrade/upgradebase",
"//pkg/util",
"//pkg/util/binfetcher",
"//pkg/util/envutil",
"//pkg/util/log",
"//pkg/util/randutil",
Expand Down
Loading

0 comments on commit 8550794

Please sign in to comment.