Help us shape the future of Go! Take the 2026 Go Developer Survey

e2e

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

README

End to end tests for DistributedRedisCluster and RedisClusterBackup

Run test in Kubernetes

kubectl create -f deploy/e2e.yml

Build and push e2e test images

DOCKER_REGISTRY=your_registry make push-e2e

Documentation

Index

Constants

View Source
const (
	Redis3_1_12 = "uhub.service.ucloud.cn/operator/redis:3.2.12-alpine"
	Redis4_0_14 = "uhub.service.ucloud.cn/operator/redis:4.0.14-alpine"
	Redis5_0_4  = "uhub.service.ucloud.cn/operator/redis:5.0.4-alpine"
	Redis5_0_6  = "uhub.service.ucloud.cn/operator/redis:5.0.6-alpine"

	BackupImage = "uhub.service.ucloud.cn/operator/redis-tools:5.0.4"

	S3ID       = "AWS_ACCESS_KEY_ID"
	S3KEY      = "AWS_SECRET_ACCESS_KEY"
	S3ENDPOINT = "S3_ENDPOINT"
	S3BUCKET   = "S3_BUCKET"

	// RedisRenameCommandsDefaultPath default path to volume storing rename commands
	RedisRenameCommandsDefaultPath = "/etc/secret-volume"
	// RedisRenameCommandsDefaultFile default file name containing rename commands
	RedisRenameCommandsDefaultFile = ""
)

Variables

This section is empty.

Functions

func ChangeDRCRedisConfig

func ChangeDRCRedisConfig(drc *redisv1alpha1.DistributedRedisCluster)

func DeleteMasterPodForDRC

func DeleteMasterPodForDRC(drc *redisv1alpha1.DistributedRedisCluster, client client.Client)

func Failf

func Failf(format string, args ...interface{})

Failf reports a failure in the current e2e

func IsDBSizeConsistent added in v0.2.2

func IsDBSizeConsistent(originalDBSize int64, goredis *GoRedis) error

func IsDRCPodBeDeleted added in v0.2.2

func IsDRCPodBeDeleted(f *Framework, drc *redisv1alpha1.DistributedRedisCluster) func() error

func IsDistributedRedisClusterProperly

func IsDistributedRedisClusterProperly(f *Framework, drc *redisv1alpha1.DistributedRedisCluster) func() error

func IsRedisClusterBackupProperly

func IsRedisClusterBackupProperly(f *Framework, drcb *redisv1alpha1.RedisClusterBackup) func() error

func LogAndReturnErrorf

func LogAndReturnErrorf(format string, args ...interface{}) error

LogAndReturnErrorf logs and return an error

func Logf

func Logf(format string, args ...interface{})

Logf logs in e2e framework

func NewDistributedRedisCluster

func NewDistributedRedisCluster(name, namespace, image, passwordName string, masterSize, clusterReplicas int32) *redisv1alpha1.DistributedRedisCluster

func NewRedisAdmin

func NewRedisAdmin(pods []corev1.Pod, password string, cfg *config.Redis, reqLogger logr.Logger) (redisutil.IAdmin, error)

NewRedisAdmin builds and returns new redis.Admin from the list of pods

func NewRedisClusterBackup

func NewRedisClusterBackup(name, namespace, image, drcName, storageSecretName, s3Endpoint, s3Bucket string) *redisv1alpha1.RedisClusterBackup

func RandString

func RandString(n int) string

RandString create a random string

func ResetPassword added in v0.2.4

func ResetPassword(drc *redisv1alpha1.DistributedRedisCluster, passwordSecret string)

func RollingUpdateDRC

func RollingUpdateDRC(drc *redisv1alpha1.DistributedRedisCluster)

func ScaleUPDRC

func ScaleUPDRC(drc *redisv1alpha1.DistributedRedisCluster)

func ScaleUPDown

func ScaleUPDown(drc *redisv1alpha1.DistributedRedisCluster)

Types

type Framework

type Framework struct {
	KubeConfig *rest.Config
	Client     client.Client
	// contains filtered or unexported fields
}

func NewFramework

func NewFramework(name string) *Framework

NewFramework create a new Framework with name

func (*Framework) AfterEach

func (f *Framework) AfterEach() error

AfterEach runs after each test

func (*Framework) BeforeEach

func (f *Framework) BeforeEach() error

BeforeEach runs before each test

func (*Framework) CreateRedisCluster

func (f *Framework) CreateRedisCluster(instance *redisv1alpha1.DistributedRedisCluster) error

CreateRedisCluster creates a DistributedRedisCluster in test namespace

func (*Framework) CreateRedisClusterBackup

func (f *Framework) CreateRedisClusterBackup(instance *redisv1alpha1.RedisClusterBackup) error

CreateRedisClusterBackup creates a RedisClusterBackup in test namespace

func (*Framework) CreateRedisClusterPassword

func (f *Framework) CreateRedisClusterPassword(name, password string) error

CreateRedisClusterPassword creates a password for DistributedRedisCluster

func (*Framework) CreateS3Secret

func (f *Framework) CreateS3Secret(id, key string) error

CreateS3Secret creates a secret for RedisClusterBackup

func (*Framework) DeleteRedisCluster

func (f *Framework) DeleteRedisCluster(instance *redisv1alpha1.DistributedRedisCluster) error

DeleteRedisCluster delete a DistributedRedisCluster in test namespace

func (*Framework) Failf

func (f *Framework) Failf(format string, a ...interface{})

Logf write log to ginkgo output

func (*Framework) GetDRCPodsByLabels

func (f *Framework) GetDRCPodsByLabels(labels map[string]string) (*corev1.PodList, error)

func (*Framework) GetDRCStatefulSetByLabels

func (f *Framework) GetDRCStatefulSetByLabels(labels map[string]string) (*appsv1.StatefulSetList, error)

func (*Framework) Logf

func (f *Framework) Logf(format string, a ...interface{})

Logf write log to ginkgo output

func (*Framework) Namespace

func (f *Framework) Namespace() string

Namespace return the test namespace name

func (*Framework) NewPasswordName added in v0.2.4

func (f *Framework) NewPasswordName() string

func (*Framework) PasswordName

func (f *Framework) PasswordName() string

func (*Framework) S3SecretName

func (f *Framework) S3SecretName() string

func (*Framework) UpdateRedisCluster

func (f *Framework) UpdateRedisCluster(instance *redisv1alpha1.DistributedRedisCluster) error

UpdateRedisCluster update a DistributedRedisCluster in test namespace

type GoRedis added in v0.2.2

type GoRedis struct {
	// contains filtered or unexported fields
}

GoRedis contains ClusterClient.

func NewGoRedis added in v0.2.2

func NewGoRedis(addr, password string) *GoRedis

NewGoRedis return a new ClusterClient.

func NewGoRedisClient added in v0.2.2

func NewGoRedisClient(svc, namespaces, password string) *GoRedis

func (*GoRedis) Close added in v0.2.2

func (g *GoRedis) Close() error

Close closes the cluster client.

func (*GoRedis) DBSize added in v0.2.2

func (g *GoRedis) DBSize() (int64, error)

DBSize return DBsize of all master nodes.

func (*GoRedis) Password added in v0.2.2

func (g *GoRedis) Password() string

Password return redis password.

func (*GoRedis) StuffingData added in v0.2.2

func (g *GoRedis) StuffingData(round, n int) error

StuffingData filled with (round * n)'s key.

Jump to

Keyboard shortcuts

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