diff --git a/Gopkg.lock b/Gopkg.lock index 03ca2350227f..828cef1f9345 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -406,11 +406,11 @@ [[projects]] branch = "master" - digest = "1:0bfb531e077e1f287ed41f059dc5a8f2bde8827d02890d3aadea88f9ccba1b33" + digest = "1:9c071ae52ffbdc073585b61aced5dfd0d5aa658815c36bbb51362993a00353a8" name = "github.com/cockroachdb/datadriven" packages = ["."] pruneopts = "UT" - revision = "474fb724652d5548aed79577a2280abee1e9302e" + revision = "1cff7050b0ae084e5178fc82da15995d8a32761d" [[projects]] digest = "1:35ff61e02c035785971ac6ec04d54428307a986412e5d0aea86b8b7f45677d09" diff --git a/pkg/ccl/storageccl/engineccl/pebble_key_manager_test.go b/pkg/ccl/storageccl/engineccl/pebble_key_manager_test.go index 588e6b626e42..550ad295bdbb 100644 --- a/pkg/ccl/storageccl/engineccl/pebble_key_manager_test.go +++ b/pkg/ccl/storageccl/engineccl/pebble_key_manager_test.go @@ -245,7 +245,7 @@ func TestDataKeyManager(t *testing.T) { } datadriven.RunTest(t, "testdata/data_key_manager", - func(d *datadriven.TestData) string { + func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { case "init": data := strings.Split(d.Input, "\n") diff --git a/pkg/cli/dump_test.go b/pkg/cli/dump_test.go index f8c4facf1d04..3f9a313fe159 100644 --- a/pkg/cli/dump_test.go +++ b/pkg/cli/dump_test.go @@ -60,7 +60,7 @@ func TestDumpData(t *testing.T) { c.omitArgs = true defer c.cleanup() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { args := []string{d.Cmd} switch d.Cmd { case "sql": diff --git a/pkg/sql/explain_tree_test.go b/pkg/sql/explain_tree_test.go index 9fa43321fa16..ab4bbc3c17f2 100644 --- a/pkg/sql/explain_tree_test.go +++ b/pkg/sql/explain_tree_test.go @@ -40,7 +40,7 @@ func TestPlanToTreeAndPlanToString(t *testing.T) { USE t; `) - datadriven.RunTest(t, "testdata/explain_tree", func(d *datadriven.TestData) string { + datadriven.RunTest(t, "testdata/explain_tree", func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { case "exec": r.Exec(t, d.Input) diff --git a/pkg/sql/opt/idxconstraint/index_constraints_test.go b/pkg/sql/opt/idxconstraint/index_constraints_test.go index 4947be8346ba..7b4c8d9af78e 100644 --- a/pkg/sql/opt/idxconstraint/index_constraints_test.go +++ b/pkg/sql/opt/idxconstraint/index_constraints_test.go @@ -71,7 +71,7 @@ func TestIndexConstraints(t *testing.T) { semaCtx := tree.MakeSemaContext() evalCtx := tree.MakeTestingEvalContext(cluster.MakeTestingClusterSettings()) - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { var varTypes []*types.T var indexCols []opt.OrderingColumn var notNullCols opt.ColSet diff --git a/pkg/sql/opt/memo/expr_test.go b/pkg/sql/opt/memo/expr_test.go index 5b0c409ae123..0f7be4c9b72a 100644 --- a/pkg/sql/opt/memo/expr_test.go +++ b/pkg/sql/opt/memo/expr_test.go @@ -59,7 +59,7 @@ func TestExprIsNeverNull(t *testing.T) { datadriven.Walk(t, "testdata/expr", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { var varTypes []*types.T var iVarHelper tree.IndexedVarHelper var err error diff --git a/pkg/sql/opt/memo/memo_test.go b/pkg/sql/opt/memo/memo_test.go index eec9ec351a63..66c83b8e1109 100644 --- a/pkg/sql/opt/memo/memo_test.go +++ b/pkg/sql/opt/memo/memo_test.go @@ -310,7 +310,7 @@ func traverseExpr(expr memo.RelExpr, f func(memo.RelExpr)) { func runDataDrivenTest(t *testing.T, path string, fmtFlags memo.ExprFmtFlags) { datadriven.Walk(t, path, func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) tester.Flags.ExprFormat = fmtFlags return tester.RunCommand(t, d) diff --git a/pkg/sql/opt/norm/norm_test.go b/pkg/sql/opt/norm/norm_test.go index 780fd4f7bab3..c2e49cd4261b 100644 --- a/pkg/sql/opt/norm/norm_test.go +++ b/pkg/sql/opt/norm/norm_test.go @@ -42,7 +42,7 @@ func TestNormRules(t *testing.T) { memo.ExprFmtHideQualifications | memo.ExprFmtHideScalars datadriven.Walk(t, "testdata/rules", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) tester.Flags.ExprFormat = fmtFlags return tester.RunCommand(t, d) diff --git a/pkg/sql/opt/optbuilder/builder_test.go b/pkg/sql/opt/optbuilder/builder_test.go index 743263eced90..05f820f607e9 100644 --- a/pkg/sql/opt/optbuilder/builder_test.go +++ b/pkg/sql/opt/optbuilder/builder_test.go @@ -57,7 +57,7 @@ func TestBuilder(t *testing.T) { datadriven.Walk(t, "testdata", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { var varTypes []*types.T var iVarHelper tree.IndexedVarHelper var err error diff --git a/pkg/sql/opt/optgen/cmd/optgen/main_test.go b/pkg/sql/opt/optgen/cmd/optgen/main_test.go index f99622f1b2eb..18ea0c3445b8 100644 --- a/pkg/sql/opt/optgen/cmd/optgen/main_test.go +++ b/pkg/sql/opt/optgen/cmd/optgen/main_test.go @@ -37,7 +37,7 @@ func TestOptgen(t *testing.T) { for _, path := range paths { t.Run(filepath.Base(path), func(t *testing.T) { - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { var buf bytes.Buffer gen := optgen{useGoFmt: true, maxErrors: 2, stdErr: &buf} diff --git a/pkg/sql/opt/optgen/exprgen/expr_gen_test.go b/pkg/sql/opt/optgen/exprgen/expr_gen_test.go index 0f95ae42a8f4..1b195f0bdf17 100644 --- a/pkg/sql/opt/optgen/exprgen/expr_gen_test.go +++ b/pkg/sql/opt/optgen/exprgen/expr_gen_test.go @@ -21,7 +21,7 @@ import ( func TestExprGen(t *testing.T) { datadriven.Walk(t, "testdata", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) return tester.RunCommand(t, d) }) diff --git a/pkg/sql/opt/optgen/lang/compiler_test.go b/pkg/sql/opt/optgen/lang/compiler_test.go index 86ae6b0e2086..06cc238ecf72 100644 --- a/pkg/sql/opt/optgen/lang/compiler_test.go +++ b/pkg/sql/opt/optgen/lang/compiler_test.go @@ -21,7 +21,7 @@ import ( ) func TestCompiler(t *testing.T) { - datadriven.RunTest(t, "testdata/compiler", func(d *datadriven.TestData) string { + datadriven.RunTest(t, "testdata/compiler", func(t *testing.T, d *datadriven.TestData) string { // Only compile command supported. if d.Cmd != "compile" { t.FailNow() diff --git a/pkg/sql/opt/optgen/lang/parser_test.go b/pkg/sql/opt/optgen/lang/parser_test.go index c79112d92f98..ffb1cc3e7e91 100644 --- a/pkg/sql/opt/optgen/lang/parser_test.go +++ b/pkg/sql/opt/optgen/lang/parser_test.go @@ -20,7 +20,7 @@ import ( ) func TestParser(t *testing.T) { - datadriven.RunTest(t, "testdata/parser", func(d *datadriven.TestData) string { + datadriven.RunTest(t, "testdata/parser", func(t *testing.T, d *datadriven.TestData) string { // Only parse command supported. if d.Cmd != "parse" { t.FailNow() diff --git a/pkg/sql/opt/optgen/lang/scanner_test.go b/pkg/sql/opt/optgen/lang/scanner_test.go index 17d3f798ee48..408c47705c46 100644 --- a/pkg/sql/opt/optgen/lang/scanner_test.go +++ b/pkg/sql/opt/optgen/lang/scanner_test.go @@ -23,7 +23,7 @@ import ( ) func TestScanner(t *testing.T) { - datadriven.RunTest(t, "testdata/scanner", func(d *datadriven.TestData) string { + datadriven.RunTest(t, "testdata/scanner", func(t *testing.T, d *datadriven.TestData) string { // Only scan command supported. if d.Cmd != "scan" { t.FailNow() diff --git a/pkg/sql/opt/testutils/opttester/opt_tester.go b/pkg/sql/opt/testutils/opttester/opt_tester.go index 137e2cf2b021..87f8f18183ff 100644 --- a/pkg/sql/opt/testutils/opttester/opt_tester.go +++ b/pkg/sql/opt/testutils/opttester/opt_tester.go @@ -1069,9 +1069,9 @@ func (ot *OptTester) Import(tb testing.TB) { tb.Fatalf("unable to find file %s", ot.Flags.File) } path := filepath.Join(filepath.Dir(optTesterFile), "testfixtures", ot.Flags.File) - datadriven.RunTest(tb.(*testing.T), path, func(d *datadriven.TestData) string { + datadriven.RunTest(tb.(*testing.T), path, func(t *testing.T, d *datadriven.TestData) string { tester := New(ot.catalog, d.Input) - return tester.RunCommand(tb.(*testing.T), d) + return tester.RunCommand(t, d) }) } diff --git a/pkg/sql/opt/testutils/opttester/opt_tester_test.go b/pkg/sql/opt/testutils/opttester/opt_tester_test.go index 302521d3c3d4..c146ce672fc7 100644 --- a/pkg/sql/opt/testutils/opttester/opt_tester_test.go +++ b/pkg/sql/opt/testutils/opttester/opt_tester_test.go @@ -25,7 +25,7 @@ func TestOptTester(t *testing.T) { datadriven.Walk(t, "testdata", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) tester.Flags.ExprFormat = fmtFlags return tester.RunCommand(t, d) diff --git a/pkg/sql/opt/testutils/testcat/test_catalog_test.go b/pkg/sql/opt/testutils/testcat/test_catalog_test.go index e4cadf248254..a56abace415e 100644 --- a/pkg/sql/opt/testutils/testcat/test_catalog_test.go +++ b/pkg/sql/opt/testutils/testcat/test_catalog_test.go @@ -25,7 +25,7 @@ func TestCatalog(t *testing.T) { datadriven.Walk(t, "testdata", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) return tester.RunCommand(t, d) }) diff --git a/pkg/sql/opt/xform/optimizer_test.go b/pkg/sql/opt/xform/optimizer_test.go index f66727f75222..d2abd045785b 100644 --- a/pkg/sql/opt/xform/optimizer_test.go +++ b/pkg/sql/opt/xform/optimizer_test.go @@ -164,7 +164,7 @@ func TestRuleProps(t *testing.T) { defer leaktest.AfterTest(t)() datadriven.Walk(t, "testdata/ruleprops", func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) tester.Flags.ExprFormat = memo.ExprFmtHideStats | memo.ExprFmtHideCost | memo.ExprFmtHideQualifications | memo.ExprFmtHideScalars @@ -222,7 +222,7 @@ func TestExternal(t *testing.T) { func runDataDrivenTest(t *testing.T, path string, fmtFlags memo.ExprFmtFlags) { datadriven.Walk(t, path, func(t *testing.T, path string) { catalog := testcat.New() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { tester := opttester.New(catalog, d.Input) tester.Flags.ExprFormat = fmtFlags return tester.RunCommand(t, d) diff --git a/pkg/sql/pgwire/hba/hba_test.go b/pkg/sql/pgwire/hba/hba_test.go index 945edd961591..06f1a207e712 100644 --- a/pkg/sql/pgwire/hba/hba_test.go +++ b/pkg/sql/pgwire/hba/hba_test.go @@ -19,13 +19,14 @@ import ( ) func TestParse(t *testing.T) { - datadriven.RunTest(t, filepath.Join("testdata", "parse"), func(d *datadriven.TestData) string { - conf, err := Parse(d.Input) - if err != nil { - return fmt.Sprintf("error: %v\n", err) - } - return conf.String() - }) + datadriven.RunTest(t, filepath.Join("testdata", "parse"), + func(t *testing.T, d *datadriven.TestData) string { + conf, err := Parse(d.Input) + if err != nil { + return fmt.Sprintf("error: %v\n", err) + } + return conf.String() + }) } // TODO(mjibson): these are untested outside ccl +gss builds. diff --git a/pkg/sql/sem/tree/eval_test.go b/pkg/sql/sem/tree/eval_test.go index ba8293fa8615..587fd681306d 100644 --- a/pkg/sql/sem/tree/eval_test.go +++ b/pkg/sql/sem/tree/eval_test.go @@ -47,19 +47,19 @@ func TestEval(t *testing.T) { evalCtx := tree.NewTestingEvalContext(cluster.MakeTestingClusterSettings()) defer evalCtx.Stop(ctx) - walk := func(t *testing.T, getExpr func(*datadriven.TestData) string) { + walk := func(t *testing.T, getExpr func(*testing.T, *datadriven.TestData) string) { datadriven.Walk(t, filepath.Join("testdata", "eval"), func(t *testing.T, path string) { - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { if d.Cmd != "eval" { t.Fatalf("unsupported command %s", d.Cmd) } - return getExpr(d) + "\n" + return getExpr(t, d) + "\n" }) }) } walkExpr := func(t *testing.T, getExpr func(tree.TypedExpr) (tree.TypedExpr, error)) { - walk(t, func(d *datadriven.TestData) string { + walk(t, func(t *testing.T, d *datadriven.TestData) string { expr, err := parser.ParseExpr(d.Input) if err != nil { t.Fatalf("%s: %v", d.Input, err) @@ -102,7 +102,7 @@ func TestEval(t *testing.T) { s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{}) defer s.Stopper().Stop(ctx) - walk(t, func(d *datadriven.TestData) string { + walk(t, func(t *testing.T, d *datadriven.TestData) string { var res gosql.NullString if err := sqlDB.QueryRow(fmt.Sprintf("SELECT (%s)::STRING", d.Input)).Scan(&res); err != nil { return strings.TrimPrefix(err.Error(), "pq: ") @@ -165,7 +165,7 @@ func TestEval(t *testing.T) { }) t.Run("vectorized", func(t *testing.T) { - walk(t, func(d *datadriven.TestData) string { + walk(t, func(t *testing.T, d *datadriven.TestData) string { if d.Input == "B'11111111111111111111111110000101'::int4" { // Skip this test: https://github.com/cockroachdb/cockroach/pull/40790#issuecomment-532597294. return strings.TrimSpace(d.Expected) diff --git a/pkg/storage/engine/disk_map_test.go b/pkg/storage/engine/disk_map_test.go index c185244f01ea..5c881ef698aa 100644 --- a/pkg/storage/engine/disk_map_test.go +++ b/pkg/storage/engine/disk_map_test.go @@ -41,8 +41,7 @@ func (r *rocksDBMap) put(k []byte, v []byte) error { func runTestForEngine(ctx context.Context, t *testing.T, filename string, engine diskmap.Factory) { diskMaps := make(map[string]diskmap.SortedDiskMap) - datadriven.RunTest(t, filename, func(d *datadriven.TestData) string { - + datadriven.RunTest(t, filename, func(t *testing.T, d *datadriven.TestData) string { if d.Cmd == "raw-count" { var keyCount int // Trying to build a common interface to RocksDB and Pebble's iterator diff --git a/pkg/storage/engine/pebble_test.go b/pkg/storage/engine/pebble_test.go index 1f580c541ce1..f7d5872a0ad5 100644 --- a/pkg/storage/engine/pebble_test.go +++ b/pkg/storage/engine/pebble_test.go @@ -29,7 +29,7 @@ import ( func TestPebbleTimeBoundPropCollector(t *testing.T) { defer leaktest.AfterTest(t)() - datadriven.RunTest(t, "testdata/time_bound_props", func(d *datadriven.TestData) string { + datadriven.RunTest(t, "testdata/time_bound_props", func(t *testing.T, d *datadriven.TestData) string { c := &pebbleTimeBoundPropCollector{} switch d.Cmd { case "build": diff --git a/pkg/storage/replica_raft_truncation_test.go b/pkg/storage/replica_raft_truncation_test.go index 0ae4654fe060..cb5286d6d815 100644 --- a/pkg/storage/replica_raft_truncation_test.go +++ b/pkg/storage/replica_raft_truncation_test.go @@ -47,7 +47,7 @@ func TestHandleTruncatedStateBelowRaft(t *testing.T) { eng := engine.NewDefaultInMem() defer eng.Close() - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { case "prev": d.ScanArgs(t, "index", &prevTruncatedState.Index) diff --git a/pkg/testutils/pgtest/datadriven.go b/pkg/testutils/pgtest/datadriven.go index b671030d6592..267048934309 100644 --- a/pkg/testutils/pgtest/datadriven.go +++ b/pkg/testutils/pgtest/datadriven.go @@ -50,7 +50,7 @@ func RunTest(t *testing.T, path, addr, user string) { if err != nil { t.Fatal(err) } - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { case "send": for _, line := range strings.Split(d.Input, "\n") { diff --git a/pkg/testutils/reduce/datadriven.go b/pkg/testutils/reduce/datadriven.go index 8d445efd40e2..b5db1a3ab5ad 100644 --- a/pkg/testutils/reduce/datadriven.go +++ b/pkg/testutils/reduce/datadriven.go @@ -55,7 +55,7 @@ func RunTest( if testing.Verbose() { log = os.Stderr } - datadriven.RunTest(t, path, func(d *datadriven.TestData) string { + datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string { switch d.Cmd { case "contains": contains = d.Input diff --git a/vendor b/vendor index 240c2b4ba053..9d0f618900d5 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 240c2b4ba0538f7ff0044d75af9cb45e79c42324 +Subproject commit 9d0f618900d5dc66215ba1013241218efa3613a2