framework

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: Apache-2.0 Imports: 34 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 CreateTestingNS

func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.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 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 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 NewCluster

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

func NewClusterSecret

func NewClusterSecret(name, ns, pw string) *core.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 core.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) GetPodForNode

func (f *Framework) GetPodForNode(cluster *api.MysqlCluster, i int) *core.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) NodeEventuallyCondition

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

func (*Framework) WaitForPodReady

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

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

type TestContextType

type TestContextType struct {
	KubeHost    string
	KubeConfig  string
	KubeContext string

	ReportDir string

	ChartPath   string
	ChartValues string

	OperatorImage string
	SidecarImage  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