util

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 88 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ArtifactDirPath

func ArtifactDirPath() string

ArtifactDirPath returns the value of ARTIFACT_DIR environment variable

func ArtifactPath

func ArtifactPath(elem ...string) string

ArtifactPath returns the absolute path to the fix artifact file The path is relative to ARTIFACT_DIR

func BuildAuthConfiguration

func BuildAuthConfiguration(credKey string, oc *CLI) (*dockerClient.AuthConfiguration, error)

BuildAuthConfiguration constructs a non-standard dockerClient.AuthConfiguration that can be used to communicate with the openshift internal docker registry

func CheckBuildCancelled added in v3.10.0

func CheckBuildCancelled(b *buildv1.Build) bool

CheckBuildCancelled return true if the build was canceled

func CheckBuildFailed added in v3.10.0

func CheckBuildFailed(b *buildv1.Build) bool

CheckBuildFailed return true if the build failed

func CheckBuildSuccess added in v3.10.0

func CheckBuildSuccess(b *buildv1.Build) bool

CheckBuildSuccess returns true if the build succeeded

func CheckForBuildEvent

func CheckForBuildEvent(client kcoreclient.CoreV1Interface, build *buildv1.Build, reason, message string)

CheckForBuildEvent will poll a build for up to 1 minute looking for an event with the specified reason and message template.

func CheckImageStreamLatestTagPopulated added in v3.10.0

func CheckImageStreamLatestTagPopulated(i *imageapi.ImageStream) bool

CheckImageStreamLatestTagPopulated returns true if the imagestream has a ':latest' tag filed

func CheckImageStreamTagNotFound added in v3.10.0

func CheckImageStreamTagNotFound(i *imageapi.ImageStream) bool

CheckImageStreamTagNotFound return true if the imagestream update was not successful

func CheckOpenShiftNamespaceImageStreams

func CheckOpenShiftNamespaceImageStreams(oc *CLI)

CheckOpenShiftNamespaceImageStreams is a temporary workaround for the intermittent issue seen in extended tests where *something* is deleteing the pre-loaded, languange imagestreams from the OpenShift namespace

func CheckPodIsReady added in v3.10.0

func CheckPodIsReady(pod kapiv1.Pod) bool

CheckPodIsReady returns true if the pod's ready probe determined that the pod is ready.

func CheckPodIsRunning added in v3.10.0

func CheckPodIsRunning(pod kapiv1.Pod) bool

CheckPodIsRunning returns true if the pod is running

func CheckPodIsSucceeded added in v3.10.0

func CheckPodIsSucceeded(pod kapiv1.Pod) bool

CheckPodIsSucceeded returns true if the pod status is "Succdeded"

func CheckPodNoOp added in v3.10.0

func CheckPodNoOp(pod kapiv1.Pod) bool

CheckPodNoOp always returns true

func CreateExecPodOrFail

func CreateExecPodOrFail(client kcoreclient.CoreV1Interface, ns, name string) string

CreateExecPodOrFail creates a simple busybox pod in a sleep loop used as a vessel for kubectl exec commands. Returns the name of the created pod. TODO: expose upstream

func CreateResource

func CreateResource(jsonFilePath string, oc *CLI) error

CreateResource creates the resources from the supplied json file (not a template); ginkgo error checking included

func CreateTempFile added in v3.11.0

func CreateTempFile(data string) (string, error)

CreateTempFile stores the specified data in a temp dir/temp file for the test who calls it

func DeletePVCsForDeployment added in v3.10.0

func DeletePVCsForDeployment(client clientset.Interface, oc *CLI, deploymentPrefix string)

func DumpAndReturnTagging

func DumpAndReturnTagging(tags []string) ([]string, error)

DumpAndReturnTagging takes and array of tags and obtains the hex image IDs, dumps them to ginkgo for printing, and then returns them

func DumpApplicationPodLogs

func DumpApplicationPodLogs(dcName string, oc *CLI)

DumpApplicationPodLogs will dump the latest application logs for a DeploymentConfig for debug purposes

func DumpBuildLogs

func DumpBuildLogs(bc string, oc *CLI)

DumpBuildLogs will dump the latest build logs for a BuildConfig for debug purposes

func DumpBuilds added in v3.7.0

func DumpBuilds(oc *CLI)

DumpBuilds will dump the yaml for every build in the test namespace; remember, pipeline builds don't have build pods so a generic framework dump won't cat our pipeline builds objs in openshift

func DumpDeploymentLogs

func DumpDeploymentLogs(dcName string, version int64, oc *CLI)

DumpDeploymentLogs will dump the latest deployment logs for a DeploymentConfig for debug purposes

func DumpDockerInfo added in v3.10.0

func DumpDockerInfo()

DumpDockerInfo runs `docker info` and logs it to the job output

func DumpImageStreams

func DumpImageStreams(oc *CLI)

DumpImageStreams will dump both the openshift namespace and local namespace imagestreams as part of debugging when the language imagestreams in the openshift namespace seem to disappear

func DumpPersistentVolumeInfo added in v3.10.0

func DumpPersistentVolumeInfo(oc *CLI)

func DumpPodLogs

func DumpPodLogs(pods []kapiv1.Pod, oc *CLI)

func DumpPodLogsStartingWith added in v3.7.0

func DumpPodLogsStartingWith(prefix string, oc *CLI)

DumpPodLogsStartingWith will dump any pod starting with the name prefix provided

func DumpPodLogsStartingWithInNamespace added in v3.10.0

func DumpPodLogsStartingWithInNamespace(prefix, namespace string, oc *CLI)

DumpPodLogsStartingWith will dump any pod starting with the name prefix provided

func DumpPodStates added in v3.7.0

func DumpPodStates(oc *CLI)

func DumpPodsCommand added in v3.10.0

func DumpPodsCommand(c kubernetes.Interface, ns string, selector labels.Selector, cmd string)

DumpPodsCommand runs the provided command in every pod identified by selector in the provided namespace.

func ExamineDiskUsage

func ExamineDiskUsage()

ExamineDiskUsage will dump df output on the testing system; leveraging this as part of diagnosing the registry's disk filling up during external tests on jenkins

func ExaminePodDiskUsage

func ExaminePodDiskUsage(oc *CLI)

ExaminePodDiskUsage will dump df/du output on registry pod; leveraging this as part of diagnosing the registry's disk filling up during external tests on jenkins

func ExecuteTest

func ExecuteTest(t *testing.T, suite string)

func FatalErr

func FatalErr(msg interface{})

FatalErr exits the test in case a fatal error has occurred.

func FetchURL

func FetchURL(url string, retryTimeout time.Duration) (response string, err error)

FetchURL grabs the output from the specified url and returns it. It will retry once per second for duration retryTimeout if an error occurs during the request.

func FindImageFormatString added in v3.11.0

func FindImageFormatString(oc *CLI) (string, bool)

func FixturePath

func FixturePath(elem ...string) string

FixturePath returns an absolute path to a fixture file in test/extended/testdata/, test/integration/, or examples/.

func GetApplicationPods

func GetApplicationPods(oc *CLI, dcName string) (*kapiv1.PodList, error)

func GetDeploymentConfigPods

func GetDeploymentConfigPods(oc *CLI, dcName string, version int64) (*kapiv1.PodList, error)

func GetDockerImageReference

func GetDockerImageReference(c imagetypeclientset.ImageStreamInterface, name, tag string) (string, error)

GetDockerImageReference retrieves the full Docker pull spec from the given ImageStream and tag

func GetEndpointAddress

func GetEndpointAddress(oc *CLI, name string) (string, error)

GetEndpointAddress will return an "ip:port" string for the endpoint.

func GetImageIDForTags

func GetImageIDForTags(comps []string) ([]string, error)

GetImageIDForTags will obtain the hexadecimal IDs for the array of human readible image tags IDs provided

func GetMasterThreadDump

func GetMasterThreadDump(oc *CLI)

GetMasterThreadDump will get a golang thread stack dump

func GetPodForContainer

func GetPodForContainer(container kapiv1.Container) *kapiv1.Pod

GetPodForContainer creates a new Pod that runs specified container

func GetPodNamesByFilter

func GetPodNamesByFilter(c kcoreclient.PodInterface, label labels.Selector, predicate func(kapiv1.Pod) bool) (podNames []string, err error)

GetPodNamesByFilter looks up pods that satisfy the predicate and returns their names.

func GetRouterPodTemplate added in v3.11.0

func GetRouterPodTemplate(oc *CLI) (*corev1.PodTemplateSpec, string, error)

GetRouterPodTemplate finds the router pod template across different namespaces, helping to mitigate the transition from the default namespace to an operator namespace.

func GetStatefulSetPods added in v3.10.0

func GetStatefulSetPods(oc *CLI, setName string) (*kapiv1.PodList, error)

func InitTest

func InitTest()

init initialize the extended testing suite. You can set these environment variables to configure extended tests: KUBECONFIG - Path to kubeconfig containing embedded authinfo TEST_REPORT_DIR - If set, JUnit output will be written to this directory for each test TEST_REPORT_FILE_NAME - If set, will determine the name of the file that JUnit output is written to

func KubeConfigPath

func KubeConfigPath() string

KubeConfigPath returns the value of KUBECONFIG environment variable

func ListImages

func ListImages() ([]string, error)

ListImages initiates the equivalent of a `docker images`

func NewPodExecutor

func NewPodExecutor(oc *CLI, name, image string) (*podExecutor, error)

NewPodExecutor returns an executor capable of running commands in a Pod.

func ParseLabelsOrDie

func ParseLabelsOrDie(str string) labels.Selector

ParseLabelsOrDie turns the given string into a label selector or panics; for tests or other cases where you know the string is valid. TODO: Move this to the upstream labels package.

func ProwGCPSetup added in v3.11.0

func ProwGCPSetup(oc *CLI)

ProwGCPSetup makes sure certain required env vars are available in the case that extended tests are invoked directly via calls to ginkgo/extended.test

func RemoveDeploymentConfigs added in v3.10.0

func RemoveDeploymentConfigs(oc *CLI, dcs ...string) error

RemoveDeploymentConfigs deletes the given DeploymentConfigs in a namespace

func RemovePodsWithPrefixes added in v3.10.0

func RemovePodsWithPrefixes(oc *CLI, prefixes ...string) error

RemovePodsWithPrefixes deletes pods whose name begins with the supplied prefixes

func RemoveStatefulSets added in v3.10.0

func RemoveStatefulSets(oc *CLI, sets ...string) error

RemoveStatefulSets deletes the given stateful sets in a namespace

func SetupK8SNFSServerAndVolume added in v3.10.0

func SetupK8SNFSServerAndVolume(oc *CLI, count int) (*kapiv1.Pod, []*kapiv1.PersistentVolume, error)

SetupK8SNFSServerAndVolume sets up an nfs server pod with count number of persistent volumes

func StartBuild

func StartBuild(oc *CLI, args ...string) (stdout, stderr string, err error)

StartBuild executes OC start-build with the specified arguments. StdOut and StdErr from the process are returned as separate strings.

func TimedWaitForAnImageStreamTag

func TimedWaitForAnImageStreamTag(oc *CLI, namespace, name, tag string, waitTimeout time.Duration) error

TimedWaitForAnImageStreamTag waits until an image stream with given name has non-empty history for given tag. Gives up waiting after the specified waitTimeout

func VarSubOnFile

func VarSubOnFile(srcFile string, destFile string, vars map[string]string) error

VarSubOnFile reads in srcFile, finds instances of ${key} from the map and replaces them with their associated values.

func WaitForABuild

func WaitForABuild(c buildv1clienttyped.BuildInterface, name string, isOK, isFailed, isCanceled func(*buildv1.Build) bool) error

WaitForABuild waits for a Build object to match either isOK or isFailed conditions.

func WaitForAJob

func WaitForAJob(c kbatchclient.JobInterface, name string, timeout time.Duration) error

func WaitForAnImageStream

func WaitForAnImageStream(client imagetypeclientset.ImageStreamInterface,
	name string,
	isOK, isFailed func(*imageapi.ImageStream) bool) error

WaitForAnImageStream waits for an ImageStream to fulfill the isOK function

func WaitForAnImageStreamTag

func WaitForAnImageStreamTag(oc *CLI, namespace, name, tag string) error

WaitForAnImageStreamTag waits until an image stream with given name has non-empty history for given tag. Defaults to waiting for 300 seconds

func WaitForBuildResult

func WaitForBuildResult(c buildv1clienttyped.BuildInterface, result *BuildResult) error

WaitForBuildResult updates result wit the state of the build

func WaitForDeploymentConfig

func WaitForDeploymentConfig(kc kubernetes.Interface, dcClient appsv1clienttyped.DeploymentConfigsGetter, namespace, name string, version int64, enforceNotProgressing bool, cli *CLI) error

WaitForDeploymentConfig waits for a DeploymentConfig to complete transition to a given version and report minimum availability.

func WaitForEndpointsAvailable added in v3.10.0

func WaitForEndpointsAvailable(oc *CLI, serviceName string) error

func WaitForNoPodsAvailable added in v3.10.0

func WaitForNoPodsAvailable(oc *CLI) error

WaitForNoPodsAvailable waits until there are no pods in the given namespace

func WaitForOpenShiftNamespaceImageStreams

func WaitForOpenShiftNamespaceImageStreams(oc *CLI) error

WaitForOpenShiftNamespaceImageStreams waits for the standard set of imagestreams to be imported

func WaitForPods

func WaitForPods(c kcoreclient.PodInterface, label labels.Selector, predicate func(kapiv1.Pod) bool, count int, timeout time.Duration) ([]string, error)

WaitForPods waits until given number of pods that match the label selector and satisfy the predicate are found

func WaitForQueryOutputContains

func WaitForQueryOutputContains(oc *CLI, d Database, timeout time.Duration, admin bool, query, resultSubstr string) error

WaitForQueryOutputContains will execute the query multiple times, until the specified substring is found in the results. This function should be used for testing replication, since it might take some time until the data is propagated to slaves.

func WaitForQueryOutputSatisfies

func WaitForQueryOutputSatisfies(oc *CLI, d Database, timeout time.Duration, admin bool, query string, predicate func(string) bool) error

WaitForQueryOutputSatisfies will execute the query multiple times, until the specified predicate function is return true.

func WaitForResourceQuotaSync

func WaitForResourceQuotaSync(
	client kinternalcoreclient.ResourceQuotaInterface,
	name string,
	expectedUsage kapi.ResourceList,
	expectedIsUpperLimit bool,
	timeout time.Duration,
) (kapi.ResourceList, error)

WaitForResourceQuotaSync watches given resource quota until its usage is updated to desired level or a timeout occurs. If successful, used quota values will be returned for expected resources. Otherwise an ErrWaitTimeout will be returned. If expectedIsUpperLimit is true, given expected usage must compare greater or equal to quota's usage, which is useful for expected usage increment. Otherwise expected usage must compare lower or equal to quota's usage, which is useful for expected usage decrement.

func WaitForSelfSAR added in v3.7.0

func WaitForSelfSAR(interval, timeout time.Duration, c kclientset.Interface, selfSAR authorizationapiv1.SelfSubjectAccessReviewSpec) error

func WaitForServiceAccount added in v3.11.0

func WaitForServiceAccount(c kcoreclient.ServiceAccountInterface, name string) error

WaitForServiceAccount waits until the named service account gets fully provisioned

func WaitForUserBeAuthorized added in v3.7.0

func WaitForUserBeAuthorized(oc *CLI, user, verb, resource string) error

WaitForUserBeAuthorized waits a minute until the cluster bootstrap roles are available and the provided user is authorized to perform the action on the resource.

func WaitUntilAllHelpersAreUp

func WaitUntilAllHelpersAreUp(oc *CLI, helpers []Database) error

WaitUntilAllHelpersAreUp waits until all helpers are ready to serve requests.

func WaitUntilPodIsGone

func WaitUntilPodIsGone(c kcoreclient.PodInterface, podName string, timeout time.Duration) error

WaitUntilPodIsGone waits until the named Pod will disappear

func WaitUntilUp

func WaitUntilUp(oc *CLI, d Database, timeout time.Duration) error

WaitUntilUp continuously waits for the server to become ready, up until timeout.

Types

type BuildResult

type BuildResult struct {
	// BuildPath is a resource qualified name (e.g. "build/test-1").
	BuildPath string
	// BuildName is the non-resource qualified name.
	BuildName string
	// StartBuildStdErr is the StdErr output generated by oc start-build.
	StartBuildStdErr string
	// StartBuildStdOut is the StdOut output generated by oc start-build.
	StartBuildStdOut string
	// StartBuildErr is the error, if any, returned by the direct invocation of the start-build command.
	StartBuildErr error
	// The buildconfig which generated this build.
	BuildConfigName string
	// Build is the resource created. May be nil if there was a timeout.
	Build *buildv1.Build
	// BuildAttempt represents that a Build resource was created.
	// false indicates a severe error unrelated to Build success or failure.
	BuildAttempt bool
	// BuildSuccess is true if the build was finshed successfully.
	BuildSuccess bool
	// BuildFailure is true if the build was finished with an error.
	BuildFailure bool
	// BuildCancelled is true if the build was canceled.
	BuildCancelled bool
	// BuildTimeout is true if there was a timeout waiting for the build to finish.
	BuildTimeout bool
	// Alternate log dumper function. If set, this is called instead of 'oc logs'
	LogDumper LogDumperFunc
	// The openshift client which created this build.
	Oc *CLI
}

func NewBuildResult

func NewBuildResult(oc *CLI, build *buildv1.Build) *BuildResult

func StartBuildAndWait

func StartBuildAndWait(oc *CLI, args ...string) (result *BuildResult, err error)

StartBuildAndWait executes OC start-build with the specified arguments on an existing buildconfig. Note that start-build will be run with "-o=name" as a parameter when using this method. If no error is returned from this method, it means that the build attempted successfully, NOT that the build completed. For completion information, check the BuildResult object.

func StartBuildResult

func StartBuildResult(oc *CLI, args ...string) (result *BuildResult, err error)

func (*BuildResult) AssertFailure

func (t *BuildResult) AssertFailure() *BuildResult

Dumps logs and triggers a Ginkgo assertion if the build did NOT have an error (this will not assert on timeouts)

func (*BuildResult) AssertSuccess

func (t *BuildResult) AssertSuccess() *BuildResult

Dumps logs and triggers a Ginkgo assertion if the build did NOT succeed.

func (*BuildResult) DumpLogs

func (t *BuildResult) DumpLogs()

DumpLogs sends logs associated with this BuildResult to the GinkgoWriter.

func (*BuildResult) Logs

func (t *BuildResult) Logs() (string, error)

Logs returns the logs associated with this build.

type CLI

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

CLI provides function to call the OpenShift CLI and Kubernetes and OpenShift clients.

func NewCLI

func NewCLI(project, adminConfigPath string) *CLI

NewCLI initialize the upstream E2E framework and set the namespace to match with the project name. Note that this function does not initialize the project role bindings for the namespace.

func (*CLI) AdminAppsClient added in v3.7.0

func (c *CLI) AdminAppsClient() appsv1client.Interface

func (*CLI) AdminAuthorizationClient added in v3.7.0

func (c *CLI) AdminAuthorizationClient() authorizationclientset.Interface

func (*CLI) AdminBuildClient added in v3.7.0

func (c *CLI) AdminBuildClient() buildv1client.Interface

func (*CLI) AdminConfig added in v3.10.0

func (c *CLI) AdminConfig() *restclient.Config

func (*CLI) AdminImageClient added in v3.7.0

func (c *CLI) AdminImageClient() imagev1client.Interface

func (*CLI) AdminInternalImageClient added in v3.11.0

func (c *CLI) AdminInternalImageClient() imageclientset.Interface

DEPRECATED: use external

func (*CLI) AdminInternalTemplateClient added in v3.11.0

func (c *CLI) AdminInternalTemplateClient() templateclientset.Interface

AdminClient provides an OpenShift client for the cluster admin user.

func (*CLI) AdminKubeClient

func (c *CLI) AdminKubeClient() kclientset.Interface

AdminKubeClient provides a Kubernetes client for the cluster admin user.

func (*CLI) AdminProjectClient added in v3.7.0

func (c *CLI) AdminProjectClient() projectclientset.Interface

func (*CLI) AdminRouteClient added in v3.7.0

func (c *CLI) AdminRouteClient() routeclientset.Interface

func (*CLI) AdminSecurityClient added in v3.7.0

func (c *CLI) AdminSecurityClient() securityclientset.Interface

func (*CLI) AdminTemplateClient

func (c *CLI) AdminTemplateClient() templateclient.Interface

func (*CLI) AdminUserClient added in v3.7.0

func (c *CLI) AdminUserClient() userclientset.Interface

func (*CLI) AppsClient added in v3.7.0

func (c *CLI) AppsClient() appsv1client.Interface

func (*CLI) Args

func (c *CLI) Args(args ...string) *CLI

Args sets the additional arguments for the OpenShift CLI command

func (*CLI) AsAdmin

func (c *CLI) AsAdmin() *CLI

AsAdmin changes current config file path to the admin config.

func (*CLI) AuthorizationClient added in v3.7.0

func (c *CLI) AuthorizationClient() authorizationclientset.Interface

func (*CLI) Background

func (c *CLI) Background() (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error)

Background executes the command in the background and returns the Cmd object which may be killed later via cmd.Process.Kill(). It also returns buffers holding the stdout & stderr of the command, which may be read from only after calling cmd.Wait().

func (*CLI) BackgroundRC added in v3.7.0

func (c *CLI) BackgroundRC() (*exec.Cmd, io.ReadCloser, error)

BackgroundRC executes the command in the background and returns the Cmd object which may be killed later via cmd.Process.Kill(). It returns a ReadCloser for stdout. If in doubt, use Background(). Consult the os/exec documentation.

func (*CLI) BuildClient added in v3.7.0

func (c *CLI) BuildClient() buildv1client.Interface

func (*CLI) ChangeUser

func (c *CLI) ChangeUser(name string) *CLI

ChangeUser changes the user used by the current CLI session.

func (*CLI) CreateProject added in v3.11.0

func (c *CLI) CreateProject() string

SetupProject creates a new project and assign a random user to the project. All resources will be then created within this project.

func (*CLI) Execute

func (c *CLI) Execute() error

Execute executes the current command and return error if the execution failed This function will set the default output to Ginkgo writer.

func (*CLI) ImageClient added in v3.7.0

func (c *CLI) ImageClient() imageclientset.Interface

func (*CLI) InputString

func (c *CLI) InputString(input string) *CLI

InputString adds expected input to the command

func (*CLI) InternalAdminKubeClient

func (c *CLI) InternalAdminKubeClient() kinternalclientset.Interface

AdminKubeClient provides a Kubernetes client for the cluster admin user.

func (*CLI) InternalKubeClient

func (c *CLI) InternalKubeClient() kinternalclientset.Interface

KubeClient provides a Kubernetes client for the current namespace

func (*CLI) InternalTemplateClient added in v3.11.0

func (c *CLI) InternalTemplateClient() templateclientset.Interface

Client provides an OpenShift client for the current user. If the user is not set, then it provides client for the cluster admin user

func (*CLI) KubeClient

func (c *CLI) KubeClient() kclientset.Interface

KubeClient provides a Kubernetes client for the current namespace

func (*CLI) KubeFramework

func (c *CLI) KubeFramework() *e2e.Framework

KubeFramework returns Kubernetes framework which contains helper functions specific for Kubernetes resources

func (*CLI) Namespace

func (c *CLI) Namespace() string

Namespace returns the name of the namespace used in the current test case. If the namespace is not set, an empty string is returned.

func (*CLI) Output

func (c *CLI) Output() (string, error)

Output executes the command and returns stdout/stderr combined into one string

func (*CLI) OutputToFile

func (c *CLI) OutputToFile(filename string) (string, error)

OutputToFile executes the command and store output to a file

func (*CLI) Outputs

func (c *CLI) Outputs() (string, string, error)

Outputs executes the command and returns the stdout/stderr output as separate strings

func (*CLI) ProjectClient added in v3.7.0

func (c *CLI) ProjectClient() projectclientset.Interface

func (*CLI) RESTMapper added in v3.11.0

func (c *CLI) RESTMapper() meta.RESTMapper

func (*CLI) RouteClient added in v3.7.0

func (c *CLI) RouteClient() routeclientset.Interface

func (*CLI) Run

func (c *CLI) Run(commands ...string) *CLI

Run executes given OpenShift CLI command verb (iow. "oc <verb>"). This function also override the default 'stdout' to redirect all output to a buffer and prepare the global flags such as namespace and config path.

func (*CLI) SetNamespace

func (c *CLI) SetNamespace(ns string) *CLI

SetNamespace sets a new namespace

func (*CLI) SetupProject

func (c *CLI) SetupProject()

SetupProject creates a new project and assign a random user to the project. All resources will be then created within this project.

func (*CLI) TeardownProject added in v3.10.0

func (c *CLI) TeardownProject()

TeardownProject removes projects created by this test.

func (*CLI) Template

func (c *CLI) Template(t string) *CLI

Template sets a Go template for the OpenShift CLI command. This is equivalent of running "oc get foo -o template --template='{{ .spec }}'"

func (*CLI) TemplateClient

func (c *CLI) TemplateClient() templateclient.Interface

Client provides an OpenShift client for the current user. If the user is not set, then it provides client for the cluster admin user

func (*CLI) UserClient added in v3.7.0

func (c *CLI) UserClient() userclientset.Interface

func (*CLI) UserConfig added in v3.11.0

func (c *CLI) UserConfig() *restclient.Config

func (*CLI) Username

func (c *CLI) Username() string

Username returns the name of currently logged user. If there is no user assigned for the current session, it returns 'admin'.

func (*CLI) Verbose

func (c *CLI) Verbose() *CLI

Verbose turns on printing verbose messages when executing OpenShift commands

func (CLI) WithoutNamespace

func (c CLI) WithoutNamespace() *CLI

WithoutNamespace instructs the command should be invoked without adding --namespace parameter

type Database

type Database interface {
	// PodName returns the name of the Pod this helper is bound to.
	PodName() string

	// IsReady indicates whether the underlying Pod is ready for queries.
	IsReady(oc *CLI) (bool, error)

	// Query queries the database as a regular user.
	Query(oc *CLI, query string) (string, error)

	// QueryPrivileged queries the database as a privileged user.
	QueryPrivileged(oc *CLI, query string) (string, error)

	// TestRemoteLogin tests whether it is possible to remote login to hostAddress.
	TestRemoteLogin(oc *CLI, hostAddress string) error
}

Database interface allows testing database images.

type ExitError

type ExitError struct {
	Cmd    string
	StdErr string
	*exec.ExitError
}

type GitRepo added in v3.10.0

type GitRepo struct {
	RepoPath string
	// contains filtered or unexported fields
}

func NewGitRepo added in v3.10.0

func NewGitRepo(repoName string) (GitRepo, error)

NewGitRepo creates temporary test directories with local and "remote" git repo

func (GitRepo) AddAndCommit added in v3.10.0

func (r GitRepo) AddAndCommit(file, content string) error

AddAndCommit commits a file with its content to local repo

func (GitRepo) Remove added in v3.10.0

func (r GitRepo) Remove()

Remove performs cleanup of no longer needed directories with local and "remote" git repo

type LogDumperFunc

type LogDumperFunc func(oc *CLI, br *BuildResult) (string, error)

type MissingTagError

type MissingTagError struct {
	Tags []string
}

func (MissingTagError) Error

func (mte MissingTagError) Error() string

type ReplicaSet

type ReplicaSet interface {
	// QueryPrimary queries the database on primary node as a regular user.
	QueryPrimary(oc *CLI, query string) (string, error)
}

ReplicaSet interface allows to interact with database on multiple nodes.

type SimpleReporter

type SimpleReporter struct {
	Output io.Writer
	// contains filtered or unexported fields
}

func NewSimpleReporter

func NewSimpleReporter() *SimpleReporter

func (*SimpleReporter) AfterSuiteDidRun

func (r *SimpleReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary)

func (*SimpleReporter) BeforeSuiteDidRun

func (r *SimpleReporter) BeforeSuiteDidRun(*types.SetupSummary)

func (*SimpleReporter) SpecDidComplete

func (r *SimpleReporter) SpecDidComplete(spec *types.SpecSummary)

func (*SimpleReporter) SpecSuiteDidEnd

func (r *SimpleReporter) SpecSuiteDidEnd(summary *types.SuiteSummary)

func (*SimpleReporter) SpecSuiteWillBegin

func (r *SimpleReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary)

func (*SimpleReporter) SpecWillRun

func (r *SimpleReporter) SpecWillRun(spec *types.SpecSummary)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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