Skip to content

Commit 56f0486

Browse files
committed
db: quiet down TestIteratorErrors
1 parent 7d5f9b9 commit 56f0486

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

external_test.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ func TestIteratorErrors(t *testing.T) {
7979
testOpts.Opts.FS = errorfs.Wrap(testOpts.Opts.FS, &toggle)
8080
testOpts.Opts.ReadOnly = true
8181

82-
test, err := metamorphic.New(
83-
metamorphic.GenerateOps(rng, 5000, metamorphic.TestkeysKeyFormat, metamorphic.ReadOpConfig()),
84-
testOpts, "" /* dir */, &testWriter{t: t})
82+
var logBuf bytes.Buffer
83+
defer func() {
84+
if t.Failed() {
85+
t.Log(logBuf.String())
86+
}
87+
}()
88+
89+
ops := metamorphic.GenerateOps(rng, 5000, metamorphic.TestkeysKeyFormat, metamorphic.ReadOpConfig())
90+
test, err := metamorphic.New(ops, testOpts, "" /* dir */, &logBuf)
8591
require.NoError(t, err)
8692

8793
defer func() {
@@ -117,15 +123,6 @@ func TestIteratorErrors(t *testing.T) {
117123
}
118124
}
119125

120-
type testWriter struct {
121-
t *testing.T
122-
}
123-
124-
func (w *testWriter) Write(b []byte) (int, error) {
125-
w.t.Log(string(bytes.TrimSpace(b)))
126-
return len(b), nil
127-
}
128-
129126
func BenchmarkPointLookupSeparatedValues(b *testing.B) {
130127
type config struct {
131128
name string

0 commit comments

Comments
 (0)