Documentation ¶
Overview ¶
The cosmostest package contains utilities for writing tests with cosmos, using a real database or the emulator as a backend, and with the option of multiple tests running side by side in multiple namespaces in a single collection to save costs.
Configuration The standard configuration is to have a special file "testconfig.yaml" in the currenty directory when running the test. The config struct is expected inside a key "cosmostest", like this: cosmostest: Uri: "https://foo.documents.azure.com:443/" MasterKey: "yourkeyhere==" <... other fields from Config ...>
Index ¶
- func RawClient(cfg Config) *cosmosapi.Client
- func SetupCollection(log logging.StdLogger, cfg Config, collectionId, partitionKey string) cosmos.Collection
- func SetupUniqueCollectionWithExistingDatabaseAndMinimalThroughput(log logging.StdLogger, cfg Config, id, partitionKey string) cosmos.Collection
- func TeardownCollection(collection cosmos.Collection)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RawClient ¶
Factory for constructing the underlying, proper cosmosapi.Client given configuration. This is typically called by / wrapped by the test collection providers.
func SetupCollection ¶
func TeardownCollection ¶
func TeardownCollection(collection cosmos.Collection)
Types ¶
type Config ¶
type Config struct { Uri string `yaml:"Uri"` MasterKey string `yaml:"MasterKey"` MultiTenant bool `yaml:"MultiTenant"` TlsCertificate string `yaml:"TlsCertificate"` TlsServerName string `yaml:"TlsServerName"` TlsInsecureSkipVerify bool `yaml:"TlsInsecureSkipVerify"` DbName string `yaml:"DbName"` CollectionIdPrefix string `yaml:"CollectionIdPrefix"` AllowExistingCollection bool `yaml:"AllowExistingCollection"` }
Click to show internal directories.
Click to hide internal directories.