util

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2015 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CheckBuildFailedFunc = func(b *buildapi.Build) bool {
	return b.Status.Phase == buildapi.BuildPhaseFailed || b.Status.Phase == buildapi.BuildPhaseError
}

CheckBuildFailedFunc return true if the build failed

View Source
var CheckBuildSuccessFunc = func(b *buildapi.Build) bool {
	return b.Status.Phase == buildapi.BuildPhaseComplete
}

CheckBuildSuccessFunc returns true if the build succeeded

View Source
var CheckDeploymentCompletedFunc = func(d *kapi.ReplicationController) bool {
	return d.Annotations[deployapi.DeploymentStatusAnnotation] == string(deployapi.DeploymentStatusComplete)
}

CheckDeploymentCompletedFunc returns true if the deployment completed

View Source
var CheckDeploymentFailedFunc = func(d *kapi.ReplicationController) bool {
	return d.Annotations[deployapi.DeploymentStatusAnnotation] == string(deployapi.DeploymentStatusFailed)
}

CheckDeploymentFailedFunc returns true if the deployment failed

View Source
var CheckImageStreamLatestTagPopulatedFunc = func(i *imageapi.ImageStream) bool {
	_, ok := i.Status.Tags["latest"]
	return ok
}

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

View Source
var CheckImageStreamTagNotFoundFunc = func(i *imageapi.ImageStream) bool {
	return strings.Contains(i.Annotations[imageapi.DockerImageRepositoryCheckAnnotation], "not") ||
		strings.Contains(i.Annotations[imageapi.DockerImageRepositoryCheckAnnotation], "error")
}

CheckImageStreamTagNotFoundFunc return true if the imagestream update was not successful

View Source
var TestContext e2e.TestContextType

Functions

func CorruptImage

func CorruptImage(corruptee, corruptor, strategy string)

CorruptImage is a helper that tags the image to be corrupted, the corruptee, as the corruptor string, resulting in the wrong image being used when corruptee is referenced later on; strategy is for ginkgo debug; ginkgo error checking leveraged

func CreatePodForImage

func CreatePodForImage(dockerImageReference string) *kapi.Pod

CreatePodForImage creates a Pod for the given image name. The dockerImageReference must be full docker pull spec.

func ExtendedTestPath

func ExtendedTestPath() string

ExtendedTestPath returns absolute path to extended tests directory

func FatalErr

func FatalErr(msg interface{})

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

func FixturePath

func FixturePath(elem ...string) string

FixturePath returns absolute path to given fixture file The path is relative to EXTENDED_TEST_PATH (./test/extended/*)

func GetDockerImageReference

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

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

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 KubeConfigPath

func KubeConfigPath() string

KubeConfigPath returns the value of KUBECONFIG environment variable

func PullImage

func PullImage(name string) error

PullImage, as the name implies, initiates the equivalent of a `docker pull` for the "name" parameter

func ResetImage

func ResetImage(tags map[string]string)

ResetImage is a helper the allows the programmer to undo any corruption performed by CorruptImage; ginkgo error checking leveraged

func StartBuild

func StartBuild(jsonFile, buildPrefix string, oc *CLI)

StartBuild creates a build config from the supplied json file (not a template) and then starts a build, using the supplied oc/cli client for both operations; ginkgo error checking included

func TagImage

func TagImage(tagee, tagor string) error

TagImage, as the name implies, will apply the "tagor" tag string to the image current tagged by "tagee"

func VerifyImagesDifferent

func VerifyImagesDifferent(comp1, comp2, strategy string)

VerifyImagesDifferent will that the two supplied image tags and see if they reference different hexadecimal image IDs; strategy is for ginkgo debug, also leverage ginkgo error checking

func VerifyImagesSame

func VerifyImagesSame(comp1, comp2, strategy string)

VerifyImagesSame will take the two supplied image tags and see if they reference the same hexadecimal image ID; strategy is for debug

func WaitForABuild

func WaitForABuild(c client.BuildInterface, name string, isOK, isFailed func(*buildapi.Build) bool) error

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

func WaitForADeployment added in v1.0.6

func WaitForADeployment(client kclient.ReplicationControllerInterface,
	name string,
	isOK, isFailed func(*kapi.ReplicationController) bool) error

WaitForADeployment waits for a Deployment to fulfill the isOK function

func WaitForAnImageStream added in v1.0.6

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

WaitForAnImageStream waits for an ImageStream to fulfill the isOK function

func WaitForBuild

func WaitForBuild(context, buildName string, oc *CLI)

WaitForBuild is a wrapper for WaitForABuild in this package that takes in an oc/cli client; some ginkgo based debug along with ginkgo error checking

func WaitForBuilderAccount added in v1.0.6

func WaitForBuilderAccount(c kclient.ServiceAccountsInterface) error

WaitForBuilderAccount waits until the builder service account gets fully provisioned

func WriteObjectToFile

func WriteObjectToFile(obj runtime.Object, filename string) error

WriteObjectToFile writes the JSON representation of runtime.Object into a temporary file.

Types

type CLI

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

CLI provides function to call the OpenShift CLI and Kubernetes and OpenShift REST 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) AdminREST

func (c *CLI) AdminREST() *client.Client

AdminREST provides an OpenShift REST client for the cluster admin user.

func (*CLI) Args

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

Args sets the additional arguments for the OpenShift CLI command

func (*CLI) ChangeUser

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

ChangeUser changes the user used by the current CLI session.

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 stdout.

func (*CLI) KubeFramework

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

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

func (*CLI) KubeREST

func (c *CLI) KubeREST() *kclient.Client

KubeREST provides a Kubernetes REST client for the current namespace

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 return the output as string

func (*CLI) OutputToFile

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

OutputToFile executes the command and store output to a file

func (*CLI) REST

func (c *CLI) REST() *client.Client

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

func (*CLI) Run

func (c *CLI) Run(verb 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) SetOutput

func (c *CLI) SetOutput(out io.Writer) *CLI

SetOutput allows to override the default command output

func (*CLI) SetOutputDir

func (c *CLI) SetOutputDir(dir string) *CLI

SetOutputDir change the default output directory for temporary files

func (*CLI) SetupProject

func (c *CLI) SetupProject(name string, kubeClient *kclient.Client) (*kapi.Namespace, error)

SetupProject creates a new project and assign a random user to the project. All resources will be then created within this project and Kubernetes E2E suite will destroy the project after test case finish. Note that the kubeClient is not used and serves just to make this function compatible with upstream function.

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 -t '{{ .spec }}'"

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

type MissingTagError

type MissingTagError struct {
	Tags []string
}

func (MissingTagError) Error

func (mte MissingTagError) Error() string

Jump to

Keyboard shortcuts

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