Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
35565: sqlsmith: various improvements r=mjibson a=mjibson



35662: sql: add regression tests for memory accounting bug r=lucy-zhang a=lucy-zhang

Add regression tests for a bug where backfilling a computed column or a column
with a default value using a builtin function would cause a `memory budget
exceeded` error (cockroachdb#34901). This was fixed by cockroachdb#34935.

Release note: None

Co-authored-by: Matt Jibson <[email protected]>
Co-authored-by: Lucy Zhang <[email protected]>
  • Loading branch information
3 people committed Mar 12, 2019
3 parents 6a47870 + babc9a9 + 2fb974f commit 0c6efb2
Show file tree
Hide file tree
Showing 12 changed files with 567 additions and 274 deletions.
37 changes: 37 additions & 0 deletions pkg/internal/sqlsmith/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2019 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.

package sqlsmith

import (
"os"
"testing"

"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"
)

//go:generate ../../util/leaktest/add-leaktest.sh *_test.go

func TestMain(m *testing.M) {
security.SetAssetLoader(securitytest.EmbeddedAssets)
randutil.SeedForTests()
serverutils.InitTestServerFactory(server.TestServerFactory)
serverutils.InitTestClusterFactory(testcluster.TestClusterFactory)
os.Exit(m.Run())
}
8 changes: 0 additions & 8 deletions pkg/internal/sqlsmith/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ func d9() int {
return rand.Intn(6) + 1
}

func d20() int {
return rand.Intn(20) + 1
}

func d42() int {
return rand.Intn(42) + 1
}

func d100() int {
return rand.Intn(100) + 1
}
Loading

0 comments on commit 0c6efb2

Please sign in to comment.