-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathgenerated_test.go
More file actions
127 lines (111 loc) · 3.82 KB
/
generated_test.go
File metadata and controls
127 lines (111 loc) · 3.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
// Code generated by generate-logictest, DO NOT EDIT.
package testlocal_read_committed
import (
"os"
"path/filepath"
"testing"
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/build/bazel"
"github.com/cockroachdb/cockroach/pkg/ccl"
"github.com/cockroachdb/cockroach/pkg/security/securityassets"
"github.com/cockroachdb/cockroach/pkg/security/securitytest"
"github.com/cockroachdb/cockroach/pkg/server"
"github.com/cockroachdb/cockroach/pkg/sql"
"github.com/cockroachdb/cockroach/pkg/sql/logictest"
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/randutil"
)
const configIdx = 3
var execBuildLogicTestDir string
func init() {
if bazel.BuiltWithBazel() {
var err error
execBuildLogicTestDir, err = bazel.Runfile("pkg/sql/opt/exec/execbuilder/testdata")
if err != nil {
panic(err)
}
} else {
execBuildLogicTestDir = "../../../../../../sql/opt/exec/execbuilder/testdata"
}
}
func TestMain(m *testing.M) {
defer ccl.TestingEnableEnterprise()()
securityassets.SetLoader(securitytest.EmbeddedAssets)
randutil.SeedForTests()
serverutils.InitTestServerFactory(server.TestServerFactory,
serverutils.WithTenantOption(base.TestIsForStuffThatShouldWorkWithSecondaryTenantsButDoesntYet(156124)))
serverutils.InitTestClusterFactory(testcluster.TestClusterFactory)
os.Exit(m.Run())
}
func runExecBuildLogicTest(t *testing.T, file string) {
defer sql.TestingOverrideExplainEnvVersion("CockroachDB execbuilder test version")()
skip.UnderDeadlock(t, "times out and/or hangs")
serverArgs := logictest.TestServerArgs{
DisableWorkmemRandomization: true,
ForceProductionValues: true,
// Disable the direct scans in order to keep the output of EXPLAIN (VEC)
// deterministic.
DisableDirectColumnarScans: true,
}
logictest.RunLogicTest(t, serverArgs, configIdx, filepath.Join(execBuildLogicTestDir, file))
}
// TestLogic_tmp runs any tests that are prefixed with "_", in which a dedicated
// test is not generated for. This allows developers to create and run temporary
// test files that are not checked into the repository, without repeatedly
// regenerating and reverting changes to this file, generated_test.go.
//
// TODO(mgartner): Add file filtering so that individual files can be run,
// instead of all files with the "_" prefix.
func TestLogic_tmp(t *testing.T) {
defer leaktest.AfterTest(t)()
var glob string
glob = filepath.Join(execBuildLogicTestDir, "_*")
serverArgs := logictest.TestServerArgs{
DisableWorkmemRandomization: true,
DisableOptimizerPerturbations: true,
}
logictest.RunLogicTests(t, serverArgs, configIdx, glob)
}
func TestExecBuild_explain_analyze_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "explain_analyze_read_committed")
}
func TestExecBuild_fk_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "fk_read_committed")
}
func TestExecBuild_select_for_update_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "select_for_update_read_committed")
}
func TestExecBuild_unique_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "unique_read_committed")
}
func TestExecBuild_update_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "update_read_committed")
}
func TestExecBuild_upsert_read_committed(
t *testing.T,
) {
defer leaktest.AfterTest(t)()
runExecBuildLogicTest(t, "upsert_read_committed")
}