Documentation ¶
Overview ¶
Package integration provides FerretDB integration tests.
Index ¶
- func AssertEqualAltCommandError(t testtb.TB, expected mongo.CommandError, altMessage string, actual error) bool
- func AssertEqualAltWriteError(t testtb.TB, expected mongo.WriteError, altMessage string, actual error) bool
- func AssertEqualCommandError(t testtb.TB, expected mongo.CommandError, actual error) bool
- func AssertEqualDocuments(t testtb.TB, expected, actual bson.D) bool
- func AssertEqualDocumentsSlice(t testtb.TB, expected, actual []bson.D) bool
- func AssertEqualWriteError(t testtb.TB, expected mongo.WriteError, actual error) bool
- func AssertMatchesBulkException(t testtb.TB, expected, actual error)
- func AssertMatchesCommandError(t testtb.TB, expected, actual error)
- func AssertMatchesError(t testtb.TB, expected, actual error)
- func AssertMatchesWriteError(t testtb.TB, expected, actual error)
- func CollectIDs(t testtb.TB, docs []bson.D) []any
- func CollectKeys(t testtb.TB, doc bson.D) []string
- func ConvertDocument(t testtb.TB, doc bson.D) *types.Document
- func ConvertDocuments(t testtb.TB, docs []bson.D) []*types.Document
- func FetchAll(t testtb.TB, ctx context.Context, cursor *mongo.Cursor) []bson.D
- func FilterAll(t testtb.TB, ctx context.Context, collection *mongo.Collection, filter bson.D) []bson.D
- func FindAll(t testtb.TB, ctx context.Context, collection *mongo.Collection) []bson.D
- func GenerateDocuments(startID, endID int32) (bson.A, []bson.D)
- func UnsetRaw(t testtb.TB, err error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqualAltCommandError ¶
func AssertEqualAltCommandError(t testtb.TB, expected mongo.CommandError, altMessage string, actual error) bool
AssertEqualAltCommandError asserts that the expected MongoDB error is the same as the actual (ignoring the Raw part); the alternative error message may be provided if FerretDB is unable to produce exactly the same text as MongoDB.
In general, error messages should be the same. Exceptions include:
- MongoDB typos (e.g. "sortto" instead of "sort to");
- MongoDB values formatting (e.g. we don't want to write additional code to format `{ $slice: { a: { b: 3 }, b: "string" } }` exactly the same way).
In any case, the alternative error message returned by FerretDB should not mislead users.
func AssertEqualAltWriteError ¶
func AssertEqualAltWriteError(t testtb.TB, expected mongo.WriteError, altMessage string, actual error) bool
AssertEqualAltWriteError asserts that the expected MongoDB error is the same as the actual; the alternative error message may be provided if FerretDB is unable to produce exactly the same text as MongoDB.
func AssertEqualCommandError ¶
AssertEqualCommandError asserts that the expected error is the same as the actual (ignoring the Raw part).
func AssertEqualDocuments ¶
AssertEqualDocuments asserts that two documents are equal in a way that is useful for tests (NaNs are equal, etc).
See testutil.AssertEqual for details.
func AssertEqualDocumentsSlice ¶
AssertEqualDocumentsSlice asserts that two document slices are equal in a way that is useful for tests (NaNs are equal, etc).
See testutil.AssertEqual for details.
func AssertEqualWriteError ¶
AssertEqualWriteError asserts that actual is a WriteException containing exactly one expected error (ignoring the Raw part).
func AssertMatchesBulkException ¶
AssertMatchesBulkException asserts that both errors are BulkWriteExceptions containing the same number of WriteErrors, and those WriteErrors are equal, except messages (and ignoring the Raw part).
func AssertMatchesCommandError ¶
AssertMatchesCommandError asserts that both errors are equal CommandErrors, except messages (and ignoring the Raw part).
func AssertMatchesError ¶
AssertMatchesError asserts that both errors are of same type and are equal in value, except the message and Raw part.
func AssertMatchesWriteError ¶
AssertMatchesWriteError asserts that both errors are WriteExceptions containing exactly one WriteError, and those WriteErrors are equal, except messages (and ignoring the Raw part).
func ConvertDocument ¶
ConvertDocument converts given driver's document to FerretDB's *types.Document.
func ConvertDocuments ¶
ConvertDocuments converts given driver's documents slice to FerretDB's []*types.Document.
func FilterAll ¶
func FilterAll(t testtb.TB, ctx context.Context, collection *mongo.Collection, filter bson.D) []bson.D
FilterAll returns filtered documented from the given collection sorted by _id.
func GenerateDocuments ¶
GenerateDocuments generates documents with _id ranging from startID to endID. It returns bson.A and []bson.D both containing same bson.D documents.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package cursors contains tests for cursors, tailable cursors, `getMore` command, etc.
|
Package cursors contains tests for cursors, tailable cursors, `getMore` command, etc. |
Package setup provides integration tests setup helpers.
|
Package setup provides integration tests setup helpers. |
Package shareddata provides data for tests and benchmarks.
|
Package shareddata provides data for tests and benchmarks. |