Skip to content

Commit

Permalink
Merge #40558
Browse files Browse the repository at this point in the history
40558: sql: fix a funky zone config in a test r=andreimatei a=andreimatei

The zone config in question was invalid (min bytes = max byte), but the
test didn't care cause it's a hacky test that happened to never validate
it. But as soon as you do unrelated changes to the system (e.g.
introduce a system zone config that inherits from another system zone
config), this test unexpectedly starts yelling.

Release note: None

Co-authored-by: Andrei Matei <[email protected]>
  • Loading branch information
craig[bot] and andreimatei committed Sep 9, 2019
2 parents 9f20b5c + de16457 commit 50de16a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/sql/zone_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
"github.com/gogo/protobuf/proto"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
)

var configID = sqlbase.ID(1)
Expand Down Expand Up @@ -88,8 +89,9 @@ func TestGetZoneConfig(t *testing.T) {
defaultZoneConfig := config.DefaultSystemZoneConfig()
defaultZoneConfig.NumReplicas = proto.Int32(1)
defaultZoneConfig.RangeMinBytes = proto.Int64(1 << 20)
defaultZoneConfig.RangeMaxBytes = proto.Int64(1 << 20)
defaultZoneConfig.RangeMaxBytes = proto.Int64(1 << 21)
defaultZoneConfig.GC = &config.GCPolicy{TTLSeconds: 60}
require.NoError(t, defaultZoneConfig.Validate())
params.Knobs.Server = &server.TestingKnobs{
DefaultZoneConfigOverride: &defaultZoneConfig,
DefaultSystemZoneConfigOverride: &defaultZoneConfig,
Expand Down Expand Up @@ -323,8 +325,9 @@ func TestCascadingZoneConfig(t *testing.T) {
defaultZoneConfig := config.DefaultZoneConfig()
defaultZoneConfig.NumReplicas = proto.Int32(1)
defaultZoneConfig.RangeMinBytes = proto.Int64(1 << 20)
defaultZoneConfig.RangeMaxBytes = proto.Int64(1 << 20)
defaultZoneConfig.RangeMaxBytes = proto.Int64(1 << 21)
defaultZoneConfig.GC = &config.GCPolicy{TTLSeconds: 60}
require.NoError(t, defaultZoneConfig.Validate())
params.Knobs.Server = &server.TestingKnobs{
DefaultZoneConfigOverride: &defaultZoneConfig,
DefaultSystemZoneConfigOverride: &defaultZoneConfig,
Expand Down

0 comments on commit 50de16a

Please sign in to comment.