Documentation ¶
Overview ¶
Package runner provides a wrapper for the OpenShift extended test suite image.
Index ¶
- Constants
- Variables
- type GitRepo
- type Repos
- type Runner
- func (r *Runner) Command() ([]byte, error)
- func (r *Runner) DeepCopy() *Runner
- func (r *Runner) GetLatestImageStreamTag() (string, error)
- func (r *Runner) RetrieveResults() (map[string][]byte, error)
- func (r *Runner) RetrieveTestResults() (map[string][]byte, error)
- func (r *Runner) Run(timeoutInSeconds int, stopCh <-chan struct{}) (err error)
- func (r *Runner) Status() Status
- type Status
Constants ¶
const (
// GitImage is the Docker image used to invoke Git.
GitImage = "docker.io/alpine/git:v2.26.2"
)
Variables ¶
var DefaultContainer = kubev1.Container{ Ports: []kubev1.ContainerPort{ { Name: resultsPortName, ContainerPort: resultsPort, Protocol: kubev1.ProtocolTCP, }, }, ImagePullPolicy: kubev1.PullAlways, ReadinessProbe: &kubev1.Probe{ ProbeHandler: kubev1.ProbeHandler{ HTTPGet: &kubev1.HTTPGetAction{ Path: "/", Port: intstr.FromInt(resultsPort), }, }, PeriodSeconds: 7, }, SecurityContext: &kubev1.SecurityContext{ RunAsUser: ptr.To[int64](0), }, }
DefaultContainer is used by the DefaultRunner to run workloads
var DefaultRunner = &Runner{ Name: defaultName, ImageStreamName: testImageStreamName, ImageStreamNamespace: testImageStreamNamespace, PodSpec: kubev1.PodSpec{ Containers: []kubev1.Container{ DefaultContainer, }, RestartPolicy: kubev1.RestartPolicyNever, }, OutputDir: "/test-run-results", Server: "https://kubernetes.default", CA: serviceAccountDir + "/ca.crt", TokenFile: serviceAccountDir + "/token", Logger: ginkgo.GinkgoLogr, }
DefaultRunner is a runner with the most commonly desired settings.
Functions ¶
This section is empty.
Types ¶
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 // Branch is the branch to mount Branch string }
GitRepo specifies a repository to be cloned and how it should be unpacked.
func (GitRepo) Container ¶
Container configured to clone the specified repository. Typically used as an init container.
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 ¶
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 // Server is the endpoint within the pod the Kubernetes API should be Server string // CA is the CA bundle used to auth against the Kubernetes API CA string // TokenFile is the credentials used to auth against the Kubernetes API TokenFile 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 // SkipLogsFromPod should be set to true if logs should not be collected. SkipLogsFromPod bool // Repos are cloned and mounted into the test Pod. Repos // Logger receives all messages. logr.Logger // contains filtered or unexported fields }
Runner runs the OpenShift extended test suite within a cluster.
func (*Runner) GetLatestImageStreamTag ¶
GetLatestImageStreamTag returns the From name of the latest ImageStream tag.
func (*Runner) RetrieveResults ¶
RetrieveResults gathers the results from the test Pod. Should only be called after tests are finished.
func (*Runner) RetrieveTestResults ¶
RetrieveTestResults gathers and validates the results from the test Pod. Should only be called after tests are finished. This method both fetches the results and ensures that they contain valid JUnit XML indicating that all tests passed.