Documentation ¶
Index ¶
- Variables
- type EntityMap
- func (em *EntityMap) BSONArray(id string) ([]bson.Raw, error)
- func (em *EntityMap) BSONValue(id string) (bson.RawValue, error)
- func (em *EntityMap) EventList(id string) ([]bson.Raw, error)
- func (em *EntityMap) Iterations(id string) (int32, error)
- func (em *EntityMap) Successes(id string) (int32, error)
- type Logger
- type LoggerSkipper
- type Options
- type ReadPreference
- type TestCase
- type TestFile
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEntityMapOpen is returned when a slice entity is accessed while the EntityMap is open ErrEntityMapOpen = errors.New("slices cannot be accessed while EntityMap is open") )
Functions ¶
This section is empty.
Types ¶
type EntityMap ¶
type EntityMap struct {
// contains filtered or unexported fields
}
EntityMap is used to store entities during tests. This type enforces uniqueness so no two entities can have the same ID, even if they are of different types. It also enforces referential integrity so construction of an entity that references another (e.g. a database entity references a client) will fail if the referenced entity does not exist. Accessors are available for the BSON entities.
func (*EntityMap) BSONArray ¶
BSONArray returns the BSON document array associated with id. This should only be accessed after the test is finished running
func (*EntityMap) EventList ¶
EventList returns the array of event documents associated with id. This should only be accessed after the test is finished running
func (*EntityMap) Iterations ¶
Iterations returns the number of iterations associated with id
type Logger ¶ added in v1.12.0
type Logger struct {
// contains filtered or unexported fields
}
Logger is the Sink used to captured log messages for logger verification in the unified spec tests.
type LoggerSkipper ¶
type LoggerSkipper interface { Log(args ...interface{}) Logf(format string, args ...interface{}) Skip(args ...interface{}) Skipf(format string, args ...interface{}) }
LoggerSkipper is passed to TestCase.Run to allow it to perform logging and skipping operations
type Options ¶
type Options struct { // Specifies if killAllSessions should be run after the test completes. // Defaults to true RunKillAllSessions *bool }
Options is the type used to configure tests
func MergeOptions
deprecated
func (*Options) SetRunKillAllSessions ¶
SetRunKillAllSessions sets the value for RunKillAllSessions
type ReadPreference ¶ added in v1.8.0
type ReadPreference struct { Mode string `bson:"mode"` TagSets []map[string]string `bson:"tagSets"` MaxStalenessSeconds *int64 `bson:"maxStalenessSeconds"` Hedge bson.M `bson:"hedge"` }
ReadPreference is a representation of BSON readPreference objects in tests.
func (*ReadPreference) ToReadPrefOption ¶ added in v1.8.0
func (rp *ReadPreference) ToReadPrefOption() (*readpref.ReadPref, error)
ToReadPrefOption converts a ReadPreference into a readpref.ReadPref object and will error if the original ReadPreference is malformed.
type TestCase ¶
type TestCase struct { Description string `bson:"description"` RunOnRequirements []mtest.RunOnBlock `bson:"runOnRequirements"` SkipReason *string `bson:"skipReason"` Operations []*operation `bson:"operations"` ExpectedEvents []*expectedEvents `bson:"expectEvents"` ExpectLogMessages []*clientLogMessages `bson:"expectLogMessages"` Outcome []*collectionData `bson:"outcome"` // contains filtered or unexported fields }
TestCase holds and runs a unified spec test case
func ParseTestFile ¶
func ParseTestFile(t *testing.T, testJSON []byte, expectValidFail bool, opts ...*Options) ([]mtest.RunOnBlock, []*TestCase)
ParseTestFile create an array of TestCases from the testJSON json blob
func (*TestCase) EndLoop ¶
func (tc *TestCase) EndLoop()
EndLoop will cause the runner to stop a loop operation if one is included in the test. If the test has finished running, this will panic
func (*TestCase) GetEntities ¶
GetEntities returns a pointer to the EntityMap for the TestCase. This should not be called until after the test is run
func (*TestCase) Run ¶
func (tc *TestCase) Run(ls LoggerSkipper) error
Run runs the TestCase and returns an error if it fails
type TestFile ¶
type TestFile struct { Description string `bson:"description"` SchemaVersion string `bson:"schemaVersion"` RunOnRequirements []mtest.RunOnBlock `bson:"runOnRequirements"` CreateEntities []map[string]*entityOptions `bson:"createEntities"` InitialData []*collectionData `bson:"initialData"` TestCases []*TestCase `bson:"tests"` }
TestFile holds the contents of a unified spec test file
Source Files ¶
- admin_helpers.go
- bsonutil.go
- bucket_options.go
- bulkwrite_helpers.go
- client_encryption_operation_execution.go
- client_entity.go
- client_operation_execution.go
- collection_data.go
- collection_operation_execution.go
- common_options.go
- context.go
- crud_helpers.go
- cursor_entity.go
- cursor_operation_execution.go
- database_operation_execution.go
- db_collection_options.go
- entity.go
- error.go
- event.go
- event_verification.go
- gridfs_bucket_operation_execution.go
- logger.go
- logger_verification.go
- matches.go
- operation.go
- options.go
- result.go
- schema_version.go
- server_api_options.go
- session_operation_execution.go
- session_options.go
- testrunner_operation.go
- unified_spec_runner.go