Skip to content

Commit

Permalink
server: bark loudly if the test tenant cannot be created
Browse files Browse the repository at this point in the history
For context, the automatic test tenant machinery is currently
dependent on a CCL enterprise license check.
(This is fundamentally not necessary - see cockroachdb#103772 - but
sadly this is the way it is for now)

Prior to this patch, if the user or a test selected the creation of a
test tenant, but the test code forgot to import the required CCL go
package, the framework would announce that "a test tenant was created"
but it was actually silently failing to do so.

This led to confusing investigations where a test tenant was expected,
a test was appearing to succeed, but with a release build the same
condition would fail.

This commit enhances the situation by ensuring we have clear logging
output when the test tenant cannot be created due to the missing
CCL import.

Release note: None
  • Loading branch information
knz committed Jul 14, 2023
1 parent ebea3d4 commit e2eb31e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ go_library(
"//pkg/util/log/eventpb",
"//pkg/util/log/logcrash",
"//pkg/util/log/logpb",
"//pkg/util/log/severity",
"//pkg/util/metric",
"//pkg/util/mon",
"//pkg/util/netutil",
Expand Down
2 changes: 2 additions & 0 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/admission"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/log/severity"
"github.com/cockroachdb/cockroach/pkg/util/metric"
addrutil "github.com/cockroachdb/cockroach/pkg/util/netutil/addr"
"github.com/cockroachdb/cockroach/pkg/util/retry"
Expand Down Expand Up @@ -545,6 +546,7 @@ func (ts *TestServer) TestTenants() []serverutils.TestTenantInterface {
func (ts *TestServer) maybeStartDefaultTestTenant(ctx context.Context) error {
clusterID := ts.sqlServer.execCfg.NodeInfo.LogicalClusterID
if err := base.CheckEnterpriseEnabled(ts.st, clusterID(), "SQL servers"); err != nil {
log.Shoutf(ctx, severity.ERROR, "test tenant requested by configuration, but code organization prevents start!\n%v", err)
// If not enterprise enabled, we won't be able to use SQL Servers so eat
// the error and return without creating/starting a SQL server.
ts.cfg.DisableDefaultTestTenant = true
Expand Down

0 comments on commit e2eb31e

Please sign in to comment.