Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docstore/mongodocstore: Make TestLowerCaseFields re-runnable #3375

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docstore/drivertest/driverbenchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions docstore/drivertest/drivertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions docstore/mongodocstore/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading