functests

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDirPerm  os.FileMode = 0755
	EnvFilePerv os.FileMode = 0644
)
View Source
const (
	MAX_RETRIES_COUNT = 10
)

Variables

View Source
var Env = map[string]string{
	"IMAGES_DIR":         "images",
	"DOCKER_BRIDGE_NAME": "walg-func-test",
	"DOCKER_IP4_SUBNET":  "10.%s.0/24",
	"DOCKER_IP6_SUBNET":  "fd00:dead:beef:%s::/96",

	"COMPOSE_FILE_SUFFIX": "-docker-compose.yml",
	"TEST_ID":             "13",
	"TEST_CLEANUP_DELAY":  "60",

	"WALG_S3_PREFIX":   "s3://dbaas/DBNAME-backup/test_uuid/test_DBNAME",
	"WALG_CLIENT_PATH": "/usr/bin/wal-g",
	"WALG_CONF_DIR":    "/etc/wal-g",
	"WALG_CONF_PATH":   "/etc/wal-g/wal-g.json",

	"S3_HOST":       "minio01",
	"S3_PORT":       "9000",
	"S3_BUCKET":     "dbaas",
	"S3_ACCESS_KEY": "S3_ACCESS_KEY",
	"S3_SECRET_KEY": "S3_SECRET_KEY",

	"EXPOSE_SSH_PORT": "22",

	"BACKUP_BASE_TAG":  "walg-func-test-base",
	"BACKUP_BASE_PATH": "staging/images/base",

	"MONGO_BUILD_PATH":     ".",
	"MONGO_ADMIN_USERNAME": "admin",
	"MONGO_ADMIN_PASSWORD": "password",
	"MONGO_ADMIN_DB_NAME":  "admin",
	"MONGO_EXPOSE_MONGOD":  "27018",

	"REDIS_EXPOSE_PORT": "6379",
	"REDIS_PASSWORD":    "password",
}

Functions

func DynConf

func DynConf(env map[string]string) map[string]string

func EnvExists

func EnvExists(path string) bool

func GetRedisCtlFromTestContext added in v1.1.1

func GetRedisCtlFromTestContext(tctx *TestContext, hostName string) (*helpers.RedisCtl, error)

func InfraFromTestContext

func InfraFromTestContext(tctx *TestContext) *helpers.Infra

func MongoCtlFromTestContext

func MongoCtlFromTestContext(tctx *TestContext, host string) (*helpers.MongoCtl, error)

func ReadEnv

func ReadEnv(path string) (map[string]string, error)

func S3StorageFromTestContext

func S3StorageFromTestContext(tctx *TestContext, host string) *helpers.S3Storage

func SetupEnv

func SetupEnv(fromEnv map[string]string, envFilePath, stagingDir string) (map[string]string, error)

func SetupStaging

func SetupStaging(imagesDir, stagingDir string) error

func WalgUtilFromTestContext

func WalgUtilFromTestContext(tctx *TestContext, host string) *helpers.WalgUtil

Types

type AuxData

type AuxData struct {
	Timestamps         map[string]helpers.OpTimestamp
	Snapshots          map[string][]helpers.NsSnapshot
	CreatedBackupNames []string
	NometaBackupNames  []string
	OplogPushEnabled   bool
}

type MongoVersion

type MongoVersion struct {
	Major string
	Full  string
}

type TestContext

type TestContext struct {
	EnvFilePath        string
	Database           string
	Infra              *helpers.Infra
	Env                map[string]string
	Context            context.Context
	AuxData            AuxData
	Version            MongoVersion
	Features           []string
	PreviousBackupTime time.Time
}

func NewTestContext

func NewTestContext(envFilePath, database string, env, features map[string]string) (*TestContext, error)

func (*TestContext) CleanEnv

func (tctx *TestContext) CleanEnv() error

func (*TestContext) ContainerFQDN

func (tctx *TestContext) ContainerFQDN(name string) string

func (*TestContext) LoadEnv added in v1.1.1

func (tctx *TestContext) LoadEnv()

func (*TestContext) S3Host

func (tctx *TestContext) S3Host() string

func (*TestContext) StopEnv

func (tctx *TestContext) StopEnv() error

type TestingfWrap

type TestingfWrap func(format string, args ...interface{})

func (TestingfWrap) Errorf

func (tf TestingfWrap) Errorf(format string, args ...interface{})

Jump to

Keyboard shortcuts

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