Skip to content

Commit

Permalink
sqlnoccltest: extract new test package that doesn't import CCL
Browse files Browse the repository at this point in the history
This allows for the single test in this package (that expects that CCL
code is not loaded) to pass when `ccl` package is loaded by `sql` tests.
There is currently no enforcement that `sqlnoccltest` doesn't import
`ccl`. This adjustment is needed because the following commit introduces
a dependency on `ccl` into `sql_test`.

The alternative solution would be to adjust a couple of expected error
messages in `TestRemovePartitioningOSS` to match the behavior when `ccl`
is loaded.

Release note: None
  • Loading branch information
yuzefovich committed Jul 18, 2023
1 parent 6f42039 commit d3c4f16
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ ALL_TESTS = [
"//pkg/sql/sqlitelogictest/tests/local:local_test",
"//pkg/sql/sqlliveness/slinstance:slinstance_test",
"//pkg/sql/sqlliveness/slstorage:slstorage_test",
"//pkg/sql/sqlnoccltest:sqlnoccltest_test",
"//pkg/sql/sqlstats/insights/integration:integration_test",
"//pkg/sql/sqlstats/insights:insights_test",
"//pkg/sql/sqlstats/persistedsqlstats/sqlstatsutil:sqlstatsutil_test",
Expand Down Expand Up @@ -2052,6 +2053,7 @@ GO_TARGETS = [
"//pkg/sql/sqlliveness/slstorage:slstorage_test",
"//pkg/sql/sqlliveness/sqllivenesstestutils:sqllivenesstestutils",
"//pkg/sql/sqlliveness:sqlliveness",
"//pkg/sql/sqlnoccltest:sqlnoccltest_test",
"//pkg/sql/sqlstats/insights/integration:integration_test",
"//pkg/sql/sqlstats/insights:insights",
"//pkg/sql/sqlstats/insights:insights_test",
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ go_test(
"mutation_test.go",
"mvcc_backfiller_test.go",
"normalization_test.go",
"partition_test.go",
"pg_metadata_test.go",
"pg_oid_test.go",
"pgwire_internal_test.go",
Expand Down
27 changes: 27 additions & 0 deletions pkg/sql/sqlnoccltest/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "sqlnoccltest_test",
srcs = [
"main_test.go",
"partition_test.go",
],
args = ["-test.timeout=295s"],
deps = [
"//pkg/config/zonepb",
"//pkg/keys",
"//pkg/security/securityassets",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/sql/catalog/catalogkeys",
"//pkg/sql/catalog/catpb",
"//pkg/sql/catalog/desctestutils",
"//pkg/sql/tests",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/util/encoding",
"//pkg/util/leaktest",
"//pkg/util/log",
"//pkg/util/protoutil",
],
)
27 changes: 27 additions & 0 deletions pkg/sql/sqlnoccltest/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// 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 sqlnoccltest_test

import (
"os"
"testing"

"github.com/cockroachdb/cockroach/pkg/security/securityassets"
"github.com/cockroachdb/cockroach/pkg/security/securitytest"
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
)

func TestMain(m *testing.M) {
securityassets.SetLoader(securitytest.EmbeddedAssets)
serverutils.InitTestServerFactory(server.TestServerFactory)
os.Exit(m.Run())
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package sql_test
package sqlnoccltest_test

import (
"context"
Expand Down

0 comments on commit d3c4f16

Please sign in to comment.