From f57c16c2719bab85f689d25b7834510d1b78a213 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Fri, 9 Aug 2019 23:56:28 +0200 Subject: [PATCH] vendor: bump datadriven Picks up some fixes for papercuts. --- go.mod | 2 +- go.sum | 4 +- .../cockroachdb/datadriven/datadriven.go | 59 +++++++++++-------- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index 779e9546fe2..05197273cba 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module go.etcd.io/etcd require ( github.com/bgentry/speakeasy v0.1.0 - github.com/cockroachdb/datadriven v0.0.0-20190531201743-edce55837238 + github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa github.com/coreos/go-semver v0.2.0 github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf diff --git a/go.sum b/go.sum index 81cf4f99e1c..c6b41e6d2e4 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cockroachdb/datadriven v0.0.0-20190531201743-edce55837238 h1:uNljlOxtOHrPnRoPPx+JanqjAGZpNiqAGVBfGskd/pg= -github.com/cockroachdb/datadriven v0.0.0-20190531201743-edce55837238/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7 h1:u9SHYsPQNyt5tgDm3YN7+9dYrpK96E5wFilTFWIDZOM= diff --git a/vendor/github.com/cockroachdb/datadriven/datadriven.go b/vendor/github.com/cockroachdb/datadriven/datadriven.go index 49e73ce380f..bcc0a601903 100644 --- a/vendor/github.com/cockroachdb/datadriven/datadriven.go +++ b/vendor/github.com/cockroachdb/datadriven/datadriven.go @@ -93,36 +93,45 @@ func runTestInternal( r := newTestDataReader(t, sourceName, reader, rewrite) for r.Next(t) { - d := &r.data - actual := func() string { - defer func() { - if r := recover(); r != nil { - fmt.Printf("\npanic during %s:\n%s\n", d.Pos, d.Input) - panic(r) + t.Run("", func(t *testing.T) { + d := &r.data + actual := func() string { + defer func() { + if r := recover(); r != nil { + fmt.Printf("\npanic during %s:\n%s\n", d.Pos, d.Input) + panic(r) + } + }() + actual := f(d) + if !strings.HasSuffix(actual, "\n") { + actual += "\n" } + return actual }() - return f(d) - }() - if r.rewrite != nil { - r.emit("----") - if hasBlankLine(actual) { + if r.rewrite != nil { r.emit("----") - r.rewrite.WriteString(actual) - r.emit("----") - r.emit("----") - } else { - r.emit(actual) - } - } else if d.Expected != actual { - t.Fatalf("\n%s: %s\nexpected:\n%s\nfound:\n%s", d.Pos, d.Input, d.Expected, actual) - } else if testing.Verbose() { - input := d.Input - if input == "" { - input = "" + if hasBlankLine(actual) { + r.emit("----") + r.rewrite.WriteString(actual) + r.emit("----") + r.emit("----") + } else { + r.emit(actual) + } + } else if d.Expected != actual { + t.Fatalf("\n%s: %s\nexpected:\n%s\nfound:\n%s", d.Pos, d.Input, d.Expected, actual) + } else if testing.Verbose() { + input := d.Input + if input == "" { + input = "" + } + // TODO(tbg): it's awkward to reproduce the args, but it would be helpful. + fmt.Printf("\n%s:\n%s [%d args]\n%s\n----\n%s", d.Pos, d.Cmd, len(d.CmdArgs), input, actual) } - // TODO(tbg): it's awkward to reproduce the args, but it would be helpful. - fmt.Printf("\n%s:\n%s [%d args]\n%s\n----\n%s", d.Pos, d.Cmd, len(d.CmdArgs), input, actual) + }) + if t.Failed() { + t.FailNow() } }