Skip to content

Commit

Permalink
ccl: refactor tenant status server test to statusccl package
Browse files Browse the repository at this point in the history
Previously, tenant status server tests live within serverccl package.
However, this caused all nightly test failures to automaticallly
notify server team through GitHub code owner file.
This commit moves all tenant status server into statusccl package
and update statusccl package code owner to SQL O11y.

Release note: None
  • Loading branch information
Azhng committed Nov 9, 2021
1 parent 6c996e3 commit c95e0d7
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
/pkg/ccl/oidcccl/ @cockroachdb/server-prs
/pkg/ccl/partitionccl/ @cockroachdb/sql-schema @cockroachdb/multiregion
/pkg/ccl/serverccl/ @cockroachdb/server-prs
/pkg/ccl/serverccl/statusccl @cockroachdb/sql-observability
/pkg/ccl/telemetryccl/ @cockroachdb/obs-inf-prs
/pkg/ccl/testccl/sqlccl/ @cockroachdb/sql-queries
/pkg/ccl/testccl/workload/schemachange/ @cockroachdb/sql-schema
Expand Down
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ALL_TESTS = [
"//pkg/ccl/oidcccl:oidcccl_test",
"//pkg/ccl/partitionccl:partitionccl_test",
"//pkg/ccl/serverccl/diagnosticsccl:diagnosticsccl_test",
"//pkg/ccl/serverccl/statusccl:statusccl_test",
"//pkg/ccl/serverccl:serverccl_test",
"//pkg/ccl/spanconfigccl:spanconfigccl_test",
"//pkg/ccl/sqlproxyccl/denylist:denylist_test",
Expand Down
30 changes: 1 addition & 29 deletions pkg/ccl/serverccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,9 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "serverccl",
srcs = [
"doc.go",
"tenant_test_utils.go",
],
srcs = ["doc.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/serverccl",
visibility = ["//visibility:public"],
deps = [
"//pkg/base",
"//pkg/roachpb:with-mocks",
"//pkg/security",
"//pkg/server/serverpb",
"//pkg/sql/pgwire",
"//pkg/sql/sqlstats/persistedsqlstats",
"//pkg/sql/tests",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/util/httputil",
"//pkg/util/log",
"//pkg/util/protoutil",
"@com_github_stretchr_testify//require",
],
)

go_test(
Expand All @@ -33,8 +15,6 @@ go_test(
"main_test.go",
"role_authentication_test.go",
"server_sql_test.go",
"tenant_grpc_test.go",
"tenant_status_test.go",
"tenant_vars_test.go",
],
embed = [":serverccl"],
Expand All @@ -45,21 +25,14 @@ go_test(
"//pkg/ccl/utilccl",
"//pkg/ccl/utilccl/licenseccl",
"//pkg/roachpb:with-mocks",
"//pkg/rpc",
"//pkg/security",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/server/serverpb",
"//pkg/sql",
"//pkg/sql/catalog/catconstants",
"//pkg/sql/catalog/descpb",
"//pkg/sql/idxusage",
"//pkg/sql/pgwire/pgcode",
"//pkg/sql/sqlstats",
"//pkg/sql/tests",
"//pkg/testutils",
"//pkg/testutils/serverutils",
"//pkg/testutils/skip",
"//pkg/testutils/sqlutils",
"//pkg/testutils/testcluster",
"//pkg/util",
Expand All @@ -68,7 +41,6 @@ go_test(
"//pkg/util/log",
"//pkg/util/randutil",
"//pkg/util/timeutil",
"@com_github_cockroachdb_errors//:errors",
"@com_github_elastic_gosigar//:gosigar",
"@com_github_lib_pq//:pq",
"@com_github_prometheus_client_model//go",
Expand Down
61 changes: 61 additions & 0 deletions pkg/ccl/serverccl/statusccl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "statusccl",
srcs = ["tenant_test_utils.go"],
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/serverccl/statusccl",
visibility = ["//visibility:public"],
deps = [
"//pkg/base",
"//pkg/roachpb:with-mocks",
"//pkg/security",
"//pkg/server/serverpb",
"//pkg/sql/pgwire",
"//pkg/sql/sqlstats/persistedsqlstats",
"//pkg/sql/tests",
"//pkg/testutils/serverutils",
"//pkg/testutils/sqlutils",
"//pkg/util/httputil",
"//pkg/util/log",
"//pkg/util/protoutil",
"@com_github_stretchr_testify//require",
],
)

go_test(
name = "statusccl_test",
srcs = [
"main_test.go",
"tenant_grpc_test.go",
"tenant_status_test.go",
],
embed = [":statusccl"],
deps = [
"//pkg/base",
"//pkg/ccl",
"//pkg/ccl/kvccl",
"//pkg/ccl/utilccl",
"//pkg/roachpb:with-mocks",
"//pkg/rpc",
"//pkg/security",
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/server/serverpb",
"//pkg/sql/catalog/catconstants",
"//pkg/sql/catalog/descpb",
"//pkg/sql/idxusage",
"//pkg/sql/sqlstats",
"//pkg/sql/tests",
"//pkg/testutils",
"//pkg/testutils/serverutils",
"//pkg/testutils/skip",
"//pkg/testutils/sqlutils",
"//pkg/testutils/testcluster",
"//pkg/util/leaktest",
"//pkg/util/log",
"//pkg/util/randutil",
"//pkg/util/timeutil",
"@com_github_cockroachdb_errors//:errors",
"@com_github_stretchr_testify//require",
],
)
34 changes: 34 additions & 0 deletions pkg/ccl/serverccl/statusccl/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2021 The Cockroach Authors.
//
// Licensed as a CockroachDB Enterprise file under the Cockroach Community
// License (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

package statusccl

import (
"os"
"testing"

_ "github.com/cockroachdb/cockroach/pkg/ccl"
"github.com/cockroachdb/cockroach/pkg/ccl/utilccl"
"github.com/cockroachdb/cockroach/pkg/security"
"github.com/cockroachdb/cockroach/pkg/security/securitytest"
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/randutil"
)

func TestMain(m *testing.M) {
defer utilccl.TestingEnableEnterprise()()
security.SetAssetLoader(securitytest.EmbeddedAssets)
randutil.SeedForTests()
serverutils.InitTestServerFactory(server.TestServerFactory)
serverutils.InitTestClusterFactory(testcluster.TestClusterFactory)
os.Exit(m.Run())
}

//go:generate ../../../util/leaktest/add-leaktest.sh *_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

package serverccl
package statusccl

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

package serverccl
package statusccl

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt

package serverccl
package statusccl

import (
"context"
Expand Down

0 comments on commit c95e0d7

Please sign in to comment.