Skip to content

Commit

Permalink
docstore/mongodocstore: Make TestLowerCaseFields re-runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
vangent committed Dec 28, 2023
1 parent 6cd2499 commit eaad13c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docstore/mongodocstore/mongo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"errors"
"fmt"
"io"
"testing"
"time"

Expand Down Expand Up @@ -236,6 +237,25 @@ func TestLowercaseFields(t *testing.T) {
}
coll := docstore.NewCollection(dc)
defer coll.Close()
defer func() {
// Delete all items in the collection.
iter := coll.Query().Get(ctx)
dels := coll.Actions()
for {
doc := map[string]interface{}{}
err := iter.Next(ctx, doc)
if err == io.EOF {
break
}
if err != nil {
t.Fatalf("%+v", err)
}
dels.Delete(doc)
}
if err := dels.Do(ctx); err != nil {
t.Fatalf("%+v", err)
}
}()

type S struct {
ID, F, G int
Expand Down

0 comments on commit eaad13c

Please sign in to comment.