Skip to content

Commit

Permalink
catkv: add data-driven tests
Browse files Browse the repository at this point in the history
This commit adds test coverage to the CatalogReader implementations.

Release note: None
  • Loading branch information
Marius Posta committed Dec 9, 2022
1 parent db87999 commit 9949508
Show file tree
Hide file tree
Showing 5 changed files with 901 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 @@ -289,6 +289,7 @@ ALL_TESTS = [
"//pkg/sql/catalog/descs:descs_test",
"//pkg/sql/catalog/funcdesc:funcdesc_test",
"//pkg/sql/catalog/hydrateddesc:hydrateddesc_test",
"//pkg/sql/catalog/internal/catkv:catkv_test",
"//pkg/sql/catalog/internal/validate:validate_test",
"//pkg/sql/catalog/lease:lease_test",
"//pkg/sql/catalog/multiregion:multiregion_test",
Expand Down Expand Up @@ -1404,6 +1405,7 @@ GO_TARGETS = [
"//pkg/sql/catalog/hydrateddesc:hydrateddesc_test",
"//pkg/sql/catalog/ingesting:ingesting",
"//pkg/sql/catalog/internal/catkv:catkv",
"//pkg/sql/catalog/internal/catkv:catkv_test",
"//pkg/sql/catalog/internal/validate:validate",
"//pkg/sql/catalog/internal/validate:validate_test",
"//pkg/sql/catalog/lease:lease",
Expand Down
40 changes: 39 additions & 1 deletion pkg/sql/catalog/internal/catkv/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data")
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 = "catkv",
Expand Down Expand Up @@ -45,4 +45,42 @@ go_library(
],
)

go_test(
name = "catkv_test",
size = "small",
srcs = [
"catalog_reader_test.go",
"main_test.go",
],
args = ["-test.timeout=55s"],
data = glob(["testdata/**"]),
deps = [
":catkv",
"//pkg/base",
"//pkg/kv",
"//pkg/security/securityassets",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/sql",
"//pkg/sql/catalog",
"//pkg/sql/catalog/catalogkeys",
"//pkg/sql/catalog/descpb",
"//pkg/sql/catalog/nstree",
"//pkg/sql/parser",
"//pkg/testutils",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/testutils/testcluster",
"//pkg/util/leaktest",
"//pkg/util/log",
"//pkg/util/randutil",
"//pkg/util/tracing",
"//pkg/util/tracing/tracingpb",
"@com_github_cockroachdb_datadriven//:datadriven",
"@com_github_kylelemons_godebug//diff",
"@com_github_stretchr_testify//require",
"@in_gopkg_yaml_v2//:yaml_v2",
],
)

get_x_data(name = "get_x_data")
Loading

0 comments on commit 9949508

Please sign in to comment.