cosmostest

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: MIT Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func RawClient

func RawClient(cfg Config) *cosmosapi.Client

Factory for constructing the underlying, proper cosmosapi.Client given configuration. This is typically called by / wrapped by the test collection providers.

func SetupCollection

func SetupCollection(log logging.StdLogger, cfg Config, collectionId, partitionKey string) cosmos.Collection

func SetupUniqueCollectionWithExistingDatabaseAndMinimalThroughput

func SetupUniqueCollectionWithExistingDatabaseAndMinimalThroughput(log logging.StdLogger, cfg Config, id, partitionKey string) cosmos.Collection

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL