utils

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//RetryLoop params for tests.
	RetryLoop = 30
	//RetryInterval param for test - wait time while in RetryLoop
	RetryInterval = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandArgs

type CommandArgs struct {
	Command             string
	SubCommand          string
	CmdArgs             []string
	OptionalArgs        []string
	PipeToStdIn         string
	EnvironmentVariable []string
}

CommandArgs is a warpper for cmd args

type CommandOut

type CommandOut struct {
	StdOut   string
	StdErr   string
	ExitCode int
	Err      error
}

CommandOut is a wrapper for cmd out returned after executing command args

func ExecuteCommand

func ExecuteCommand(cmdStruct CommandArgs) CommandOut

ExecuteCommand executes a os command with stdin and returns output

type K8sHelper

type K8sHelper struct {
	Clientset *kubernetes.Clientset
	// contains filtered or unexported fields
}

K8sHelper is a helper for common kubectl commads

func CreatK8sHelper

func CreatK8sHelper() (*K8sHelper, error)

CreatK8sHelper creates a instance of k8sHelper

func (*K8sHelper) DeleteResource

func (k8sh *K8sHelper) DeleteResource(args []string) (string, error)

DeleteResource performs a kubectl delete on give args

func (*K8sHelper) GetK8sServerVersion

func (k8sh *K8sHelper) GetK8sServerVersion() string

GetK8sServerVersion returns k8s server version under test

func (*K8sHelper) GetMonIP

func (k8sh *K8sHelper) GetMonIP(mon string) (string, error)

GetMonIP returns IP address for a ceph mon pod

func (*K8sHelper) GetMonitorServices

func (k8sh *K8sHelper) GetMonitorServices() (map[string]string, error)

GetMonitorServices returns all ceph mon pod names

func (*K8sHelper) GetPVCStatus

func (k8sh *K8sHelper) GetPVCStatus(name string) (string, error)

GetPVCStatus returns status of PVC

func (*K8sHelper) GetPodDetails

func (k8sh *K8sHelper) GetPodDetails(podNamePattern string, namespace string) (string, error)

GetPodDetails returns details about a pod

func (*K8sHelper) GetPodHostID

func (k8sh *K8sHelper) GetPodHostID(podNamePattern string, namespace string) (string, error)

GetPodHostID returns HostIP address of a pod

func (*K8sHelper) GetRGWServiceURL

func (k8sh *K8sHelper) GetRGWServiceURL() (string, error)

GetRGWServiceURL returns URL of ceph RGW service in the cluster

func (*K8sHelper) GetResource

func (k8sh *K8sHelper) GetResource(args []string) (string, error)

GetResource performs a kubectl get on give args

func (*K8sHelper) GetService

func (k8sh *K8sHelper) GetService(servicename string) (string, error)

GetService returns output from "kubectl get svc $NAME" command

func (*K8sHelper) IsCRDPresent

func (k8sh *K8sHelper) IsCRDPresent(crdName string) bool

IsCRDPresent returns true if custom resource definition is present

func (*K8sHelper) IsPodInExpectedState

func (k8sh *K8sHelper) IsPodInExpectedState(podNamePattern string, namespace string, state string) bool

IsPodInExpectedState waits for 90s for a pod to be an expected state If the pod is in expected state within 90s true is returned, if not false

func (*K8sHelper) IsPodRunning

func (k8sh *K8sHelper) IsPodRunning(name string) bool

IsPodRunning returns true if a Pod is running status or goes to Running status within 90s else returns false

func (*K8sHelper) IsPodRunningInNamespace

func (k8sh *K8sHelper) IsPodRunningInNamespace(name string) bool

IsPodRunningInNamespace returns true if a Pod in a namespace is running status or goes to Running status within 90s else returns false

func (*K8sHelper) IsPodTerminated

func (k8sh *K8sHelper) IsPodTerminated(name string) bool

IsPodTerminated returns true if a Pod is terminated status or goes to Terminated status within 90s else returns false\

func (*K8sHelper) IsPodTerminatedInNamespace

func (k8sh *K8sHelper) IsPodTerminatedInNamespace(name string) bool

IsPodTerminatedInNamespace returns true if a Pod in a namespace is terminated status or goes to Terminated status within 90s else returns false\

func (*K8sHelper) IsServiceUp

func (k8sh *K8sHelper) IsServiceUp(name string) bool

IsServiceUp returns true if a service is up or comes up within 40s, else returns false

func (*K8sHelper) IsServiceUpInNameSpace

func (k8sh *K8sHelper) IsServiceUpInNameSpace(name string) bool

IsServiceUpInNameSpace returns true if a service in a namespace is up or comes up within 40s, else returns false

func (*K8sHelper) IsStorageClassPresent

func (k8sh *K8sHelper) IsStorageClassPresent(name string) (bool, error)

IsStorageClassPresent returns true if storageClass is present, if not false

func (*K8sHelper) IsThirdPartyResourcePresent

func (k8sh *K8sHelper) IsThirdPartyResourcePresent(tprname string) bool

IsThirdPartyResourcePresent returns true if Third party resource is present

func (*K8sHelper) Kubectl

func (k8sh *K8sHelper) Kubectl(args ...string) (string, error)

Kubectl is wrapper for executing kubectl commands

func (*K8sHelper) KubectlWithStdin

func (k8sh *K8sHelper) KubectlWithStdin(stdin string, args ...string) (string, error)

KubectlWithStdin is wrapper for executing kubectl commands in stdin

func (*K8sHelper) ResourceOperation

func (k8sh *K8sHelper) ResourceOperation(action string, podDefiniton string) (string, error)

ResourceOperation performs a kubectl action on a pod definition

func (*K8sHelper) ResourceOperationFromTemplate

func (k8sh *K8sHelper) ResourceOperationFromTemplate(action string, podDefinition string, config map[string]string) (string, error)

ResourceOperationFromTemplate performs a kubectl action from a template file after replacing its context

func (*K8sHelper) WaitUntilPVCIsBound

func (k8sh *K8sHelper) WaitUntilPVCIsBound(pvcname string) bool

WaitUntilPVCIsBound waits for a PVC to be in bound state for 90 seconds if PVC goes to Bound state within 90s True is returned, if not false

func (*K8sHelper) WaitUntilPodInNamespaceIsDeleted

func (k8sh *K8sHelper) WaitUntilPodInNamespaceIsDeleted(podNamePattern string, namespace string) bool

WaitUntilPodInNamespaceIsDeleted waits for 90s for a pod in a namespace to be terminated If the pod disappears within 90s true is returned, if not false

func (*K8sHelper) WaitUntilPodIsDeleted

func (k8sh *K8sHelper) WaitUntilPodIsDeleted(podNamePattern string) bool

WaitUntilPodIsDeleted waits for 90s for a pod to be terminated If the pod disappears within 90s true is returned, if not false

type MySQLHelper

type MySQLHelper struct {
	DB *sql.DB
}

MySQLHelper contains pointer to MySqlDB and wrappers for basic object on mySql database

func CreateNewMySQLHelper

func CreateNewMySQLHelper(username string, password string, url string, dbname string) *MySQLHelper

CreateNewMySQLHelper creates a s3 client for specfied endpoint and creds

func (*MySQLHelper) CloseConnection

func (h *MySQLHelper) CloseConnection()

CloseConnection function closes mysql connection

func (*MySQLHelper) CreateTable

func (h *MySQLHelper) CreateTable() sql.Result

CreateTable func create sample Table

func (*MySQLHelper) DeleteRandomRow

func (h *MySQLHelper) DeleteRandomRow() sql.Result

DeleteRandomRow deletes a random row

func (*MySQLHelper) InsertRandomData

func (h *MySQLHelper) InsertRandomData() sql.Result

InsertRandomData Inserts random Data into the table

func (*MySQLHelper) PingSuccess

func (h *MySQLHelper) PingSuccess() bool

PingSuccess function is used check connection to a database

func (*MySQLHelper) TableExists

func (h *MySQLHelper) TableExists() bool

TableExists checks if a table exists

func (*MySQLHelper) TableRowCount

func (h *MySQLHelper) TableRowCount() (count int)

TableRowCount gets row count of table

type S3Helper

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

S3Helper contains pointer to s3 client and wrappers for basic object store operations

func CreateNewS3Helper

func CreateNewS3Helper(endpoint string, keyID string, keySecret string) *S3Helper

CreateNewS3Helper creates a s3 client for specfied endpoint and creds

func (*S3Helper) CreateBucket

func (h *S3Helper) CreateBucket(name string) (bool, error)

CreateBucket function creates bucket using s3 client

func (*S3Helper) DeleteBucket

func (h *S3Helper) DeleteBucket(name string) (bool, error)

DeleteBucket function deletes given bucket using s3 client

func (*S3Helper) DeleteObjectInBucket

func (h *S3Helper) DeleteObjectInBucket(bucketname string, key string) (bool, error)

DeleteObjectInBucket function deletes given bucket using s3 client

func (*S3Helper) GetObjectInBucket

func (h *S3Helper) GetObjectInBucket(bucketname string, key string) (string, error)

GetObjectInBucket function retrieves an object from a bucket using s3 client

func (*S3Helper) PutObjectInBucket

func (h *S3Helper) PutObjectInBucket(bucketname string, body string, key string,
	contentType string) (bool, error)

PutObjectInBucket function puts an object in a bucket using s3 client

Jump to

Keyboard shortcuts

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