tu

package
v0.0.3-0...-d79a22f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tu has Test Util functions

Index

Constants

View Source
const (
	// MongoSPort Mongos Port
	MongosPort = "17000"
	// MongoDBS1PrimaryPort MongoDB Shard 1 Primary Port
	MongoDBS1PrimaryPort = "17001"
	// MongoDBS1Secondary1Port MongoDB Shard 1 first Secondary Port
	MongoDBS1Secondary1Port = "17002"
	// MongoDBS1Secondary2Port MongoDB Shard 1 second Secondary Port
	MongoDBS1Secondary2Port = "17003"
	// MongoDBConfigServerPrimaryPort MongoDB Config server cluster's primary
	MongoDBConfigServerPrimaryPort = "17007"
	// MongoDBConfigServerSecondary1Port MongoDB Config server cluster's first secondary
	MongoDBConfigServerSecondary1Port = "17008"
	// MongoDBConfigServerSecondary2Port MongoDB Config server cluster's second secondary
	MongoDBConfigServerSecondary2Port = "17009"
	// MongoDBStandAlonePort MongoDB stand alone instance Port
	MongoDBStandAlonePort = "27017"
)

Variables

This section is empty.

Functions

func DefaultTestClient

func DefaultTestClient(ctx context.Context, t *testing.T) *mongo.Client

DefaultTestClient returns the default MongoDB connection used for tests. It is a direct connection to the primary server of replicaset 1.

func GetenvDefault

func GetenvDefault(key, defaultValue string) string

GetenvDefault gets a variable from the environment and returns its value or the spacified default if the variable is empty.

func TestClient

func TestClient(ctx context.Context, port string, t *testing.T) *mongo.Client

TestClient returns a new MongoDB connection to the specified server port.

Types

This section is empty.

Jump to

Keyboard shortcuts

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