testutils

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MongoDBHost is the hostname. Since it runs locally, it is localhost
	MongoDBHost = "127.0.0.1"

	// Port for standalone instance
	MongoDBStandalonePort = getEnvDefault(envMongoDBStandalonePort, "27017")

	// MongoDBShard1ReplsetName Replicaset name for shard 1
	MongoDBShard1ReplsetName = getEnvDefault(envMongoDBShard1ReplsetName, "rs1")
	// MongoDBShard1PrimaryPort is the port for the primary instance of shard 1
	MongoDBShard1PrimaryPort = getEnvDefault(envMongoDBShard1PrimaryPort, "17001")
	// MongoDBShard1Secondary1Port is the port for the secondary instance 1 of shard 1
	MongoDBShard1Secondary1Port = getEnvDefault(envMongoDBShard1Secondary1Port, "17002")
	// MongoDBShard1Secondary2Port is the port for the secondary instance 2 of shard 1
	MongoDBShard1Secondary2Port = getEnvDefault(envMongoDBShard1Secondary2Port, "17003")

	// MongoDBShard2ReplsetName Replicaset name for shard 2
	MongoDBShard2ReplsetName = getEnvDefault(envMongoDBShard2ReplsetName, "rs2")
	// MongoDBShard2PrimaryPort is the port for the primary instance of shard 2
	MongoDBShard2PrimaryPort = getEnvDefault(envMongoDBShard2PrimaryPort, "17004")
	// MongoDBShard2Secondary1Port is the port for the secondary instance 1 of shard 2
	MongoDBShard2Secondary1Port = getEnvDefault(envMongoDBShard2Secondary1Port, "17005")
	// MongoDBShard2Secondary2Port is the port for the secondary instance 1 of shard 2
	MongoDBShard2Secondary2Port = getEnvDefault(envMongoDBShard2Secondary2Port, "17006")

	// MongoDBShard3ReplsetName Replicaset name for the 3rd cluster
	MongoDBShard3ReplsetName = getEnvDefault(envMongoDBShard3ReplsetName, "rs3")
	// MongoDBShard3PrimaryPort is the port for the primary instance of 3rd cluster (non-sharded)
	MongoDBShard3PrimaryPort = getEnvDefault(envMongoDBShard3PrimaryPort, "17021")
	// MongoDBShard3Secondary1Port is the port for the secondary instance 1 on the 3rd cluster
	MongoDBShard3Secondary1Port = getEnvDefault(envMongoDBShard3Secondary1Port, "17022")
	// MongoDBShard3Secondary2Port is the port for the secondary instance 2 on the 3rd cluster
	MongoDBShard3Secondary2Port = getEnvDefault(envMongoDBShard3Secondary2Port, "17023")

	// MongoDBConfigsvrReplsetName Replicaset name for the config servers
	MongoDBConfigsvrReplsetName = getEnvDefault(envMongoDBConfigsvrReplsetName, "csReplSet")
	// MongoDBConfigsvr1Port Config server primary's port
	MongoDBConfigsvr1Port = getEnvDefault(envMongoDBConfigsvr1Port, "17007")

	// MongoDBMongosPort mongos port
	MongoDBMongosPort = getEnvDefault(envMongoDBMongosPort, "17000")
	// MongoDBUser username for all instances
	MongoDBUser = getEnvDefault(envMongoDBUser, "admin")
	// MongoDBPassword password for all instances
	MongoDBPassword = getEnvDefault(envMongoDBPassword, "admin123456")
	// MongoDBTimeout global connection timeout
	MongoDBTimeout = time.Duration(10) * time.Second

	// MongoDBSSLDir is the directory having the SSL certs
	MongoDBSSLDir = "../docker/test/ssl"
	// MongoDBSSLPEMKeyFile PEM file used on all instances
	MongoDBSSLPEMKeyFile = filepath.Join(MongoDBSSLDir, "client.pem")
	// MongoDBSSLCACertFile CA file used on all instances
	MongoDBSSLCACertFile = filepath.Join(MongoDBSSLDir, "rootCA.crt")
)

Functions

func BaseDir

func BaseDir() string

BaseDir returns the project's root dir by asking git

func GetMongoDBAddr

func GetMongoDBAddr(rs, name string) string

GetMongoDBAddr returns the address of an instance by replicaset name and instance type like (rs1, primary) or (rs1, secondary1)

func GetMongoDBReplsetAddrs

func GetMongoDBReplsetAddrs(rs string) []string

GetMongoDBReplsetAddrs return the addresses of all instances for a replicaset name

Types

This section is empty.

Jump to

Keyboard shortcuts

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