functests

package
v0.0.0-...-e89a0ad Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 20 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

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 SetupCommonSteps

func SetupCommonSteps(ctx *godog.ScenarioContext, tctx *TestContext)

func SetupMongodbBinaryBackupSteps

func SetupMongodbBinaryBackupSteps(ctx *godog.ScenarioContext, tctx *TestContext)

func SetupMongodbLogicalSteps

func SetupMongodbLogicalSteps(ctx *godog.ScenarioContext, tctx *TestContext)

func SetupMongodbSteps

func SetupMongodbSteps(ctx *godog.ScenarioContext, tctx *TestContext)

func SetupNewEnv

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

func SetupRedisSteps

func SetupRedisSteps(ctx *godog.ScenarioContext, tctx *TestContext)

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
	Infra              *helpers.Infra
	Env                map[string]string
	Context            context.Context
	AuxData            AuxData
	Version            MongoVersion
	PreviousBackupTime time.Time
}

func CreateTestContex

func CreateTestContex(database string) (tctx *TestContext, err error)

func (*TestContext) CleanEnv

func (tctx *TestContext) CleanEnv() error

func (*TestContext) ContainerFQDN

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

func (*TestContext) LoadEnv

func (tctx *TestContext) LoadEnv() (err error)

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