Skip to content

Commit

Permalink
logictest: add test for mixed-version configs
Browse files Browse the repository at this point in the history
This commit adds a test that verifies that for each supported previous
release we have a logictest config that bootstraps the cluster at that
version.

Informs: #112629
Release note: None
  • Loading branch information
RaduBerinde committed Nov 13, 2023
1 parent cdf9262 commit 123a2dc
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ ALL_TESTS = [
"//pkg/sql/lex:lex_disallowed_imports_test",
"//pkg/sql/lex:lex_test",
"//pkg/sql/lexbase:lexbase_test",
"//pkg/sql/logictest/logictestbase:logictestbase_test",
"//pkg/sql/logictest/tests/5node-disk:5node-disk_test",
"//pkg/sql/logictest/tests/5node:5node_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master:cockroach-go-testserver-upgrade-to-master_test",
Expand Down Expand Up @@ -1851,6 +1852,7 @@ GO_TARGETS = [
"//pkg/sql/lexbase:lexbase",
"//pkg/sql/lexbase:lexbase_test",
"//pkg/sql/logictest/logictestbase:logictestbase",
"//pkg/sql/logictest/logictestbase:logictestbase_test",
"//pkg/sql/logictest/tests/5node-disk:5node-disk_test",
"//pkg/sql/logictest/tests/5node:5node_test",
"//pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master:cockroach-go-testserver-upgrade-to-master_test",
Expand Down
9 changes: 8 additions & 1 deletion pkg/sql/logictest/logictestbase/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "logictestbase",
Expand All @@ -12,3 +12,10 @@ go_library(
"//pkg/roachpb",
],
)

go_test(
name = "logictestbase_test",
srcs = ["logictestbase_test.go"],
embed = [":logictestbase"],
deps = ["//pkg/clusterversion"],
)
31 changes: 31 additions & 0 deletions pkg/sql/logictest/logictestbase/logictestbase_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2023 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package logictestbase

import (
"testing"

"github.com/cockroachdb/cockroach/pkg/clusterversion"
)

func TestLogicTestMixedVersionConfigs(t *testing.T) {
// Verify there is a mixed-version config for each supported release.
for _, v := range clusterversion.SupportedPreviousReleases() {
t.Run(v.String(), func(t *testing.T) {
for _, c := range LogicTestConfigs {
if c.DisableUpgrade && c.BootstrapVersion == v {
return
}
}
t.Errorf("no mixed-version config for %v", v)
})
}
}

0 comments on commit 123a2dc

Please sign in to comment.