framework

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodStartTimeout = 5 * time.Minute
	// How often to Poll pods, nodes and claims.
	Poll = 2 * time.Second
)
View Source
const (
	DefaultNamespaceDeletionTimeout = 10 * time.Minute
)
View Source
const (
	RecommendedConfigPathEnvVar = "MYSQLOPERATORCONFIGS"
)

Variables

View Source
var OrchestratorPort = 3000
View Source
var (
	POLLING = 2 * time.Second
)

Functions

func BackupCompleted added in v0.2.2

func BackupCompleted() gomegatypes.GomegaMatcher

BackupCompleted a matcher to check cluster completion

func CreateTestingNS

func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*corev1.Namespace, error)

CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name. Please see NewFramework instead of using this directly.

func DeleteNS

func DeleteNS(c clientset.Interface, namespace string, timeout time.Duration) error

deleteNS deletes the provided namespace, waits for it to be completely deleted, and then checks whether there are any pods remaining in a non-terminating state.

func Failf

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

func GetBucketName added in v0.2.2

func GetBucketName() string

func GetClusterLabels added in v0.2.2

func GetClusterLabels(cluster *api.MysqlCluster) labels.Set

GetClusterLabels returns labels.Set for the given cluster

func GetNameForJob added in v0.2.2

func GetNameForJob(backup *api.MysqlBackup) string

GetNameForJob returns the job name of a backup

func GetNameForResource added in v0.2.0

func GetNameForResource(name string, cluster *api.MysqlCluster) string

GetNameForResource returns the name of the cluster resource, see the function definition for what name means.

func GetPodLogs

func GetPodLogs(c clientset.Interface, namespace, podName, containerName string) (string, error)

func HaveBackupCond added in v0.2.2

func HaveBackupCond(condType api.BackupConditionType, status corev1.ConditionStatus) gomegatypes.GomegaMatcher

HaveBackupCond is a helper func that returns a matcher to check for an existing condition in a ClusterCondition list.

func HaveClusterCond added in v0.2.2

func HaveClusterCond(condType api.ClusterConditionType, status corev1.ConditionStatus) gomegatypes.GomegaMatcher

HaveClusterCond is a helper func that returns a matcher to check for an existing condition in a ClusterCondition list.

func HaveClusterReplicas added in v0.2.2

func HaveClusterReplicas(replicas int) gomegatypes.GomegaMatcher

HaveClusterRepliacs matcher for replicas

func HelmInstallChart

func HelmInstallChart(release, ns string)

func HelmPurgeRelease

func HelmPurgeRelease(release string)

func LoadConfig

func LoadConfig() (*restclient.Config, error)

func LogContainersInPodsWithLabels

func LogContainersInPodsWithLabels(c clientset.Interface, ns string, match map[string]string, containerSubstr string, logFunc func(ftm string, args ...interface{}))

func LogPodsWithLabels

func LogPodsWithLabels(c clientset.Interface, ns string, match map[string]string, logFunc func(ftm string, args ...interface{}))

func Logf

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

func NewBackup added in v0.2.2

func NewBackup(cluster *api.MysqlCluster, bucket string) *api.MysqlBackup

func NewCluster

func NewCluster(name, ns string) *api.MysqlCluster

func NewClusterSecret

func NewClusterSecret(name, ns, pw string) *corev1.Secret

func OrcClusterName

func OrcClusterName(cluster *api.MysqlCluster) string

func RegisterCommonFlags

func RegisterCommonFlags()

Register flags common to all e2e test suites.

func RegisterParseFlags

func RegisterParseFlags()

func RemoveCleanupAction

func RemoveCleanupAction(p CleanupActionHandle)

RemoveCleanupAction removes a function that was installed by AddCleanupAction.

func RestclientConfig

func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)

func RunCleanupActions

func RunCleanupActions()

RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.

Types

type CleanupActionHandle

type CleanupActionHandle *int

func AddCleanupAction

func AddCleanupAction(fn func()) CleanupActionHandle

AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite().

type Framework

type Framework struct {
	BaseName  string
	Namespace *core.Namespace

	Client    client.Client
	ClientSet clientset.Interface

	SkipNamespaceCreation bool

	OrcClient orc.Interface

	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewFramework

func NewFramework(baseName string) *Framework

func (*Framework) AfterEach

func (f *Framework) AfterEach()

AfterEach deletes the namespace, after reading its events.

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach gets a client and makes a namespace.

func (*Framework) ClusterEventuallyCondition

func (f *Framework) ClusterEventuallyCondition(cluster *api.MysqlCluster,
	condType api.ClusterConditionType, status corev1.ConditionStatus, timeout time.Duration)

func (*Framework) CreateNamespace

func (f *Framework) CreateNamespace(labels map[string]string) (*core.Namespace, error)

func (*Framework) ExecSQLOnNode

func (f *Framework) ExecSQLOnNode(cluster *api.MysqlCluster, i int, user, password, query string) *sql.Rows

func (*Framework) GetClusterPVCsFn added in v0.2.2

func (f *Framework) GetClusterPVCsFn(cluster *api.MysqlCluster) func() []corev1.PersistentVolumeClaim

func (*Framework) GetPodForNode

func (f *Framework) GetPodForNode(cluster *api.MysqlCluster, i int) *corev1.Pod

func (*Framework) GetPodHostname added in v0.2.0

func (f *Framework) GetPodHostname(cluster *api.MysqlCluster, p int) string

GetPodHostname returns for an index the pod hostname of a cluster

func (*Framework) NewGCSBackupSecret added in v0.2.2

func (f *Framework) NewGCSBackupSecret() *corev1.Secret

func (*Framework) NodeEventuallyCondition

func (f *Framework) NodeEventuallyCondition(cluster *api.MysqlCluster, nodeName string,
	condType api.NodeConditionType, status corev1.ConditionStatus, timeout time.Duration)

func (*Framework) ReadSQLTest added in v0.2.2

func (f *Framework) ReadSQLTest(cluster *api.MysqlCluster, pod int, pw string) string

func (*Framework) RefreshBackupFn added in v0.2.2

func (f *Framework) RefreshBackupFn(backup *api.MysqlBackup) func() *api.MysqlBackup

func (*Framework) RefreshClusterFn added in v0.2.2

func (f *Framework) RefreshClusterFn(cluster *api.MysqlCluster) func() *api.MysqlCluster

func (*Framework) WaitForPodReady

func (f *Framework) WaitForPodReady(podName string) error

WaitForPodReady waits for the pod to flip to ready in the namespace.

func (*Framework) WriteSQLTest added in v0.2.2

func (f *Framework) WriteSQLTest(cluster *api.MysqlCluster, pod int, pw string) string

type TestContextType

type TestContextType struct {
	KubeHost    string
	KubeConfig  string
	KubeContext string

	ReportDir string

	ChartPath   string
	ChartValues string

	OperatorImage     string
	SidecarImage      string
	OrchestratorImage string

	TimeoutSeconds    int
	DumpLogsOnFailure bool
}
var TestContext TestContextType

Directories

Path Synopsis
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.

Jump to

Keyboard shortcuts

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