runner

package
v0.0.0-...-93e563e Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package runner provides a wrapper for the OpenShift extended test suite image.

Index

Constants

View Source
const (
	// GitImage is the Docker image used to invoke Git.
	GitImage = "docker.io/alpine/git@sha256:8f5659025d83a60e9d140123bb1b27f3c334578aef10d002da4e5848580f1a6c"
)

Variables

View Source
var DefaultContainer = kubev1.Container{
	Env: []kubev1.EnvVar{
		{
			Name:  "KUBECONFIG",
			Value: "~/.kube/config",
		},
	},
	Ports: []kubev1.ContainerPort{
		{
			Name:          resultsPortName,
			ContainerPort: resultsPort,
			Protocol:      kubev1.ProtocolTCP,
		},
	},
	ImagePullPolicy: kubev1.PullAlways,
	ReadinessProbe: &kubev1.Probe{
		Handler: kubev1.Handler{
			HTTPGet: &kubev1.HTTPGetAction{
				Path: "/",
				Port: intstr.FromInt(resultsPort),
			},
		},
		PeriodSeconds: 7,
	},
}

DefaultContainer is used by the DefaultRunner to run workloads

View Source
var DefaultRunner = &Runner{
	Name:                 defaultName,
	ImageStreamName:      testImageStreamName,
	ImageStreamNamespace: testImageStreamNamespace,
	PodSpec: kubev1.PodSpec{
		Containers: []kubev1.Container{
			DefaultContainer,
		},
		RestartPolicy: kubev1.RestartPolicyNever,
	},
	OutputDir: "./results",
	AuthConfig: AuthConfig{
		Name:      "osde2e",
		Server:    "https://kubernetes.default",
		CA:        serviceAccountDir + "/ca.crt",
		TokenFile: serviceAccountDir + "/token",
	},
	Logger: log.New(os.Stderr, "", log.LstdFlags),
}

DefaultRunner is a runner with the most commonly desired settings.

View Source
var (
	ErrNotRun = errors.New("suite has not run yet")
)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Name      string
	Server    string
	CA        string
	TokenFile string
}

AuthConfig defines how the test Pod connects to the cluster.

type GitRepo

type GitRepo struct {
	// Name is used to identify the cloned repository.
	Name string

	// URL where the repository to be cloned is located.
	URL string

	// MountPath is the path where the cloned repository should be mounted.
	MountPath string
}

GitRepo specifies a repository to be cloned and how it should be unpacked.

func (GitRepo) Container

func (r GitRepo) Container() kubev1.Container

Container configured to clone the specified repository. Typically used as an init container.

func (GitRepo) Volume

func (r GitRepo) Volume() kubev1.Volume

Volume configured as empty-dir to hold clone data.

func (GitRepo) VolumeMount

func (r GitRepo) VolumeMount() kubev1.VolumeMount

VolumeMount configured to mount the cloned repository in the primary container.

type Repos

type Repos []GitRepo

Repos can modify a Pod to clone each contained GitRepo.

func (Repos) ConfigurePod

func (repos Repos) ConfigurePod(podSpec *kubev1.PodSpec)

ConfigurePod modifies the given Pod to clone the Repo and make it available to any containers.

type Runner

type Runner struct {
	// Kube client used to run test in-cluster.
	Kube kube.Interface

	// Image client used to gather ImageStream information.
	Image image.Interface

	// Name of the operation being performed.
	Name string

	// Namespace runner resources should be created in.
	Namespace string

	// ImageStreamName is the name of the ImageStream containing the suite.
	ImageStreamName string

	// ImageStreamNamespace is the namespace of the ImageStream containing the suite.
	ImageStreamNamespace string

	// ImageName is a container image used for the runner.
	ImageName string

	// Cmd is run within the test pod. If PodSpec is also set it overrides the container of the same name.
	Cmd string

	// PodSpec defines the Pod used by the runner.
	PodSpec kubev1.PodSpec

	// OutputDir is the directory that is copied from the Pod to the local host.
	OutputDir string

	// Tarball will create a single .tgz file for the entire OutputDir.
	Tarball bool

	// Repos are cloned and mounted into the test Pod.
	Repos

	// Auth defines how to connect to a cluster.
	AuthConfig

	// Logger receives all messages.
	*log.Logger
	// contains filtered or unexported fields
}

Runner runs the OpenShift extended test suite within a cluster.

func (*Runner) Command

func (r *Runner) Command() (string, error)

func (*Runner) DeepCopy

func (r *Runner) DeepCopy() *Runner

DeepCopy returns a deep copy of a runner.

func (*Runner) RetrieveResults

func (r *Runner) RetrieveResults() (map[string][]byte, error)

RetrieveResults gathers the results from the test Pod. Should only be called after tests are finished.

func (*Runner) Run

func (r *Runner) Run(stopCh <-chan struct{}) (err error)

Run deploys the suite into a cluster, waits for it to finish, and gathers the results.

func (*Runner) Status

func (r *Runner) Status() Status

Status returns the current state of the runner.

type Status

type Status string

Status is the current state of the runner.

var (
	StatusSetup   Status = "setup"
	StatusRunning Status = "running"
	StatusDone    Status = "done"
)

Jump to

Keyboard shortcuts

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