diff --git a/docstore/drivertest/driverbenchmark.go b/docstore/drivertest/driverbenchmark.go index ed3e23b1f0..4e6f5a5d3d 100644 --- a/docstore/drivertest/driverbenchmark.go +++ b/docstore/drivertest/driverbenchmark.go @@ -27,7 +27,7 @@ import ( // RunBenchmarks runs benchmarks for docstore drivers. func RunBenchmarks(b *testing.B, coll *docstore.Collection) { defer coll.Close() - clearCollection(b, coll) + ClearCollection(b, coll) b.Run("BenchmarkSingleActionPut", func(b *testing.B) { benchmarkSingleActionPut(10, b, coll) }) @@ -40,7 +40,7 @@ func RunBenchmarks(b *testing.B, coll *docstore.Collection) { b.Run("BenchmarkActionListGet", func(b *testing.B) { benchmarkActionListGet(100, b, coll) }) - clearCollection(b, coll) + ClearCollection(b, coll) } func benchmarkSingleActionPut(n int, b *testing.B, coll *docstore.Collection) { diff --git a/docstore/drivertest/drivertest.go b/docstore/drivertest/drivertest.go index 39aaaed5cd..4a5305d235 100644 --- a/docstore/drivertest/drivertest.go +++ b/docstore/drivertest/drivertest.go @@ -249,7 +249,7 @@ func withColl(t *testing.T, h Harness, kind CollectionKind, f func(*testing.T, H } coll := docstore.NewCollection(dc) defer coll.Close() - clearCollection(t, coll) + ClearCollection(t, coll) f(t, h, coll) } @@ -1541,8 +1541,8 @@ func filterHighScores(hs []*HighScore, f func(*HighScore) bool) []*HighScore { return res } -// clearCollection delete all documents from this collection after test. -func clearCollection(fataler interface{ Fatalf(string, ...interface{}) }, coll *docstore.Collection) { +// ClearCollection delete all documents from this collection after test. +func ClearCollection(fataler interface{ Fatalf(string, ...interface{}) }, coll *docstore.Collection) { ctx := context.Background() iter := coll.Query().Get(ctx) dels := coll.Actions() diff --git a/docstore/mongodocstore/mongo_test.go b/docstore/mongodocstore/mongo_test.go index 2e29e1d21e..8e45d8c78d 100644 --- a/docstore/mongodocstore/mongo_test.go +++ b/docstore/mongodocstore/mongo_test.go @@ -236,6 +236,7 @@ func TestLowercaseFields(t *testing.T) { } coll := docstore.NewCollection(dc) defer coll.Close() + defer drivertest.ClearCollection(t, coll) type S struct { ID, F, G int