Skip to content

Commit 4cc03d4

Browse files
committed
server: fix DRPC option precedence for test-specific settings
Previously, when a test explicitly set TestDRPCDisabled but a global DRPC override was configured, the global override would incorrectly take precedence. This meant tests that explicitly disabled DRPC could still end up running with DRPC enabled. The fix also adds better logging to indicate when a global override is being applied, making test behavior more transparent.
1 parent 8b1e1a9 commit 4cc03d4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/base/test_server_args.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,12 @@ type SlimTestServerConfig struct {
235235
type DefaultTestDRPCOption uint8
236236

237237
const (
238+
// TestDRPCUnset represents an uninitialized or invalid DRPC option.
239+
TestDRPCUnset DefaultTestDRPCOption = iota
240+
238241
// TestDRPCDisabled disables DRPC; all inter-node connectivity will use gRPC
239242
// only.
240-
TestDRPCDisabled DefaultTestDRPCOption = iota
243+
TestDRPCDisabled
241244

242245
// TestDRPCEnabled enables DRPC. Some services may still use gRPC if they
243246
// have not yet migrated to DRPC.

pkg/testutils/serverutils/test_server_shim.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,10 @@ func WaitForTenantCapabilities(
546546
// `TestServerArgs.Settings` based on that.
547547
func TryEnableDRPCSetting(ctx context.Context, t TestLogger, args *base.TestServerArgs) {
548548
option := args.DefaultDRPCOption
549-
if option == base.TestDRPCDisabled && globalDefaultDRPCOptionOverride.isSet {
549+
var logSuffix string
550+
if option == base.TestDRPCUnset && globalDefaultDRPCOptionOverride.isSet {
550551
option = globalDefaultDRPCOptionOverride.value
552+
logSuffix = " (override by TestingGlobalDRPCOption)"
551553
}
552554
enableDRPC := false
553555
switch option {
@@ -561,6 +563,7 @@ func TryEnableDRPCSetting(ctx context.Context, t TestLogger, args *base.TestServ
561563
return
562564
}
563565

566+
t.Log("DRPC is enabled" + logSuffix)
564567
if args.Settings == nil {
565568
args.Settings = cluster.MakeClusterSettings()
566569
}

0 commit comments

Comments
 (0)