Mongotestage
Module: github.com/wrapped-owls/testereiro/providers/mongotestage
mongotestage wires a Mongo client at factory level and binds a per-engine database provider.
| |
| |
Or reuse an existing client:
mongotestage.WithMongoClient(client)WithMongoClientstill registers provider teardown onfactory.Close(), so the client is disconnected when the factory closes.
mongotestage.ClientFromFactory(factory)mongotestage.DatabaseFromEngine(engine)
Engine database binding uses engine.DBName() internally, so each test engine maps to its own Mongo database name.
Package:
github.com/wrapped-owls/testereiro/providers/mongotestage/pkg/mongochecker
Use with:
mongotestage.NewMongoRunnerFromEngine(engine, opts...)- query options like
WithFindOneQuery,WithAggregateQuery,WithCountQuery - validators like
ExpectDoc,ExpectDocs,ExpectCount,WithCustomValidation
Package:
github.com/wrapped-owls/testereiro/providers/mongotestage/pkg/mongoseeder
Use with engine.SeedWithProvider(...):
| |
Seeding modes:
SeedModeInsertManySeedModeClientBulkWrite