framework

package
v0.0.0-...-be4dc66 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// IntegrationTestPrefix is the default prefix that will be used for test shoots if none other is specified
	IntegrationTestPrefix = "itest-"
)

Variables

View Source
var (
	// ErrNoRepositoriesFound no repositories found in repoitories file
	ErrNoRepositoriesFound = errors.New("no repositories found in repoitories file")

	// ErrNoInternalIPsForNodeWasFound no internal IPs were found for node
	ErrNoInternalIPsForNodeWasFound = errors.New("no internal IPs were found for node")

	// ErrNoRunningPodsFound no running pods were found
	ErrNoRunningPodsFound = errors.New("no running pods were found")
)
View Source
var (

	// GuestBookTemplateDir relative path for guestbook app template dir
	GuestBookTemplateDir = filepath.Join("..", "..", "resources", "templates")
)

Functions

func CreateShootTestArtifacts

func CreateShootTestArtifacts(shootTestYamlPath, prefix string) (string, *v1beta1.Shoot, error)

CreateShootTestArtifacts creates the necessary artifacts for a shoot tests including a random integration test name and a shoot object which is read from the resources directory

func EnsureDirectories

func EnsureDirectories(helm Helm) error

EnsureDirectories creates the repository directory which holds the repositories.yaml config file

func Exists

func Exists(path string) (bool, error)

Exists checks if a path exists

func ReadObject

func ReadObject(file string, into runtime.Object) error

ReadObject loads the contents of file and decodes it as a ControllerManagerConfiguration object.

Types

type GardenerTestOperation

type GardenerTestOperation struct {
	Logger       logrus.FieldLogger
	GardenClient kubernetes.Interface
	SeedClient   kubernetes.Interface
	ShootClient  kubernetes.Interface

	Seed    *v1beta1.Seed
	Shoot   *v1beta1.Shoot
	Project *v1beta1.Project
}

GardenerTestOperation holds all required instances for doing a test operation

func NewGardenTestOperation

func NewGardenTestOperation(ctx context.Context, k8sGardenClient kubernetes.Interface, logger logrus.FieldLogger, shoot *v1beta1.Shoot) (*GardenerTestOperation, error)

NewGardenTestOperation initializes a new test operation from created shoot Objects that can be used to issue commands against seeds and shoots

func (*GardenerTestOperation) DashboardAvailable

func (o *GardenerTestOperation) DashboardAvailable(ctx context.Context) error

DashboardAvailable checks if the kubernetes dashboard is available

func (*GardenerTestOperation) DeployChart

func (o *GardenerTestOperation) DeployChart(ctx context.Context, namespace, chartRepoDestination, chartNameToDeploy string) error

DeployChart deploys it on the test shoot

func (*GardenerTestOperation) DownloadChartArtifacts

func (o *GardenerTestOperation) DownloadChartArtifacts(ctx context.Context, helm Helm, chartRepoDestination, chartNameToDownload string) error

DownloadChartArtifacts downloads a helm chart from helm stable repo url available in resources/repositories

func (*GardenerTestOperation) DownloadKubeconfig

func (o *GardenerTestOperation) DownloadKubeconfig(ctx context.Context, client kubernetes.Interface, namespace, name, downloadPath string) error

DownloadKubeconfig downloads the shoot Kubeconfig

func (*GardenerTestOperation) GetDashboardPodIP

func (o *GardenerTestOperation) GetDashboardPodIP(ctx context.Context) (string, error)

GetDashboardPodIP gets the dashboard IP

func (*GardenerTestOperation) GetElasticsearchLogs

func (o *GardenerTestOperation) GetElasticsearchLogs(ctx context.Context, elasticsearchNamespace, podName string, client kubernetes.Interface) (*SearchResponse, error)

GetElasticsearchLogs gets logs for <podName> from the elasticsearch instance in <elasticsearchNamespace>

func (*GardenerTestOperation) GetFirstNodeInternalIP

func (o *GardenerTestOperation) GetFirstNodeInternalIP(ctx context.Context) (string, error)

GetFirstNodeInternalIP gets the internal IP of the first node

func (*GardenerTestOperation) HTTPGet

func (o *GardenerTestOperation) HTTPGet(ctx context.Context, url string) (*http.Response, error)

HTTPGet performs an HTTP GET request with context

func (*GardenerTestOperation) KibanaDashboardAvailable

func (o *GardenerTestOperation) KibanaDashboardAvailable(ctx context.Context) error

KibanaDashboardAvailable checks if Kibana instance in shoot seed namespace is available

func (*GardenerTestOperation) PodExecByLabel

func (o *GardenerTestOperation) PodExecByLabel(ctx context.Context, podLabels labels.Selector, podContainer, command, namespace string, client kubernetes.Interface) (io.Reader, error)

PodExecByLabel executes a command inside pods filtered by label

func (*GardenerTestOperation) ShootSeedNamespace

func (o *GardenerTestOperation) ShootSeedNamespace() string

ShootSeedNamespace gets the shoot namespace in the seed

func (*GardenerTestOperation) WaitUntilDeploymentIsRunning

func (o *GardenerTestOperation) WaitUntilDeploymentIsRunning(ctx context.Context, deploymentName, deploymentNamespace string, c kubernetes.Interface) error

WaitUntilDeploymentIsRunning waits until the deployment with <deploymentName> is running

func (*GardenerTestOperation) WaitUntilDeploymentsWithLabelsIsReady

func (o *GardenerTestOperation) WaitUntilDeploymentsWithLabelsIsReady(ctx context.Context, deploymentLabels labels.Selector, namespace string, client kubernetes.Interface) error

WaitUntilDeploymentsWithLabelsIsReady wait until pod with labels <podLabels> is running

func (*GardenerTestOperation) WaitUntilElasticsearchReceivesLogs

func (o *GardenerTestOperation) WaitUntilElasticsearchReceivesLogs(ctx context.Context, elasticsearchNamespace, podName string, expected uint64, client kubernetes.Interface) error

WaitUntilElasticsearchReceivesLogs waits until the elasticsearch instance in <elasticsearchNamespace> receives <expected> logs from <podName>

func (*GardenerTestOperation) WaitUntilGuestbookAppIsAvailable

func (o *GardenerTestOperation) WaitUntilGuestbookAppIsAvailable(ctx context.Context, guestbookAppUrls []string) error

WaitUntilGuestbookAppIsAvailable waits until the guestbook app is available and ready to serve requests

func (*GardenerTestOperation) WaitUntilStatefulSetIsRunning

func (o *GardenerTestOperation) WaitUntilStatefulSetIsRunning(ctx context.Context, statefulSetName, statefulSetNamespace string, c kubernetes.Interface) error

WaitUntilStatefulSetIsRunning waits until the stateful set with <statefulSetName> is running

type Helm

type Helm string

Helm is the home for the HELM repo

func (Helm) CacheIndex

func (h Helm) CacheIndex(name string) string

CacheIndex returns the path to an index for the given named repository.

func (Helm) Path

func (h Helm) Path(elem ...string) string

Path returns Helm path with elements appended.

func (Helm) Repository

func (h Helm) Repository() string

Repository returns the path to the local repository.

func (Helm) RepositoryFile

func (h Helm) RepositoryFile() string

RepositoryFile returns the path to the repositories.yaml file.

func (Helm) String

func (h Helm) String(elem ...string) string

Path returns the home for the helm repo with.

type HelmAccess

type HelmAccess struct {
	HelmPath Helm
}

HelmAccess is a struct that holds the helm home

type SearchResponse

type SearchResponse struct {
	Hits struct {
		Total uint64 `json:"total"`
	} `json:"hits"`
}

SearchResponse represents the response from a search query to elasticsearch

type ShootGardenerTest

type ShootGardenerTest struct {
	GardenClient kubernetes.Interface

	Shoot  *v1beta1.Shoot
	Logger *logrus.Logger
}

ShootGardenerTest represents an instance of shoot tests which entails all necessary data

func NewShootGardenerTest

func NewShootGardenerTest(kubeconfig string, shoot *v1beta1.Shoot, logger *logrus.Logger) (*ShootGardenerTest, error)

NewShootGardenerTest creates a new shootGardenerTest object, given an already created shoot (created after parsing a shoot YAML)

func (*ShootGardenerTest) AnnotateShoot

func (s *ShootGardenerTest) AnnotateShoot(ctx context.Context, annotations map[string]string) error

AnnotateShoot adds shoot annotation(s)

func (*ShootGardenerTest) CreateShoot

func (s *ShootGardenerTest) CreateShoot(ctx context.Context) (*v1beta1.Shoot, error)

CreateShoot Creates a shoot from a shoot Object

func (*ShootGardenerTest) DeleteShoot

func (s *ShootGardenerTest) DeleteShoot(ctx context.Context) error

DeleteShoot deletes the test shoot

func (*ShootGardenerTest) GetShoot

func (s *ShootGardenerTest) GetShoot(ctx context.Context) (*v1beta1.Shoot, error)

GetShoot gets the test shoot

func (*ShootGardenerTest) RemoveShootAnnotation

func (s *ShootGardenerTest) RemoveShootAnnotation(ctx context.Context, annotationKey string) error

RemoveShootAnnotation removes an annotation with key <annotationKey> from a shoot object

func (*ShootGardenerTest) WaitForShootToBeCreated

func (s *ShootGardenerTest) WaitForShootToBeCreated(ctx context.Context) error

WaitForShootToBeCreated waits for the shoot to be created

func (*ShootGardenerTest) WaitForShootToBeDeleted

func (s *ShootGardenerTest) WaitForShootToBeDeleted(ctx context.Context) error

WaitForShootToBeDeleted waits for the shoot to be deleted

Jump to

Keyboard shortcuts

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