util

package
v0.0.0-...-3256294 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 107 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AnnotateTestSuite

func AnnotateTestSuite()

func ApplyNsResourceFromTemplate

func ApplyNsResourceFromTemplate(c *CLI, namespace string, filepath string) (string, error)

ApplyNsResourceFromTemplate apply changes to the ns resource. No need to add a namespace parameter in the template file as it can be provided as a function argument. For ex: ApplyNsResourceFromTemplate(c, "NAMESPACE", "TEMPLATE_FILE")

func ApplyNsResourceFromTemplateWithVariables

func ApplyNsResourceFromTemplateWithVariables(c *CLI, namespace string, filepath string, variables map[string]string) (string, error)

ApplyNsResourceFromTemplateWithVariables apply changes to the ns resource. No need to add a namespace parameter in the template file as it can be provided as a function argument. For ex: ApplyNsResourceFromTemplateWithVariables(c, "NAMESPACE", "TEMPLATE_FILE", map{"VAR_1":"VALUE_1"})

func ApplyResourceFromTemplate

func ApplyResourceFromTemplate(c *CLI, filepath string) (string, error)

ApplyResourceFromTemplate apply the changes to the cluster resource. For ex: ApplyResourceFromTemplate(c, "TEMPLATE_FILE")

func ApplyResourceFromTemplateWithVariables

func ApplyResourceFromTemplateWithVariables(c *CLI, filepath string, args map[string]string) (string, error)

ApplyResourceFromTemplateWithVariables apply the changes to the cluster resource with args. For ex: ApplyResourceFromTemplateWithVariables(c, "TEMPLATE_FILE", map{"VAR_1":"VALUE_1"})

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 AssertWaitPollNoErr

func AssertWaitPollNoErr(e error, msg string)

AssertWaitPollNoErr e is return value of Wait.Poll msg is the reason why time out the function assert return value of Wait.Poll, and expect NO error if e is Nil, just pass and nothing happen. if e is not Nil, will not print the default error message "timed out waiting for the condition" because it causes RP AA not to analysis result exactly. if e is "timed out waiting for the condition", it is replaced by msg. if e is not "timed out waiting for the condition", it print e and then case fails.

func AssertWaitPollWithErr

func AssertWaitPollWithErr(e error, msg string)

AssertWaitPollWithErr e is return value of Wait.Poll msg is the reason why not get the function assert return value of Wait.Poll, and expect error raised. if e is not Nil, just pass and nothing happen. if e is Nil, will print expected error info and then case fails.

func CheckBuildCancelled

func CheckBuildCancelled(b *buildv1.Build) bool

CheckBuildCancelled return true if the build was canceled

func CheckBuildFailed

func CheckBuildFailed(b *buildv1.Build) bool

CheckBuildFailed return true if the build failed

func CheckBuildSuccess

func CheckBuildSuccess(b *buildv1.Build) bool

CheckBuildSuccess returns true if the build succeeded

func CheckForBuildEvent

func CheckForBuildEvent(client corev1client.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

func CheckImageStreamLatestTagPopulated(i *imagev1.ImageStream) bool

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

func CheckImageStreamTagNotFound

func CheckImageStreamTagNotFound(i *imagev1.ImageStream) bool

CheckImageStreamTagNotFound return true if the imagestream update was not successful

func CheckPodIsReady

func CheckPodIsReady(pod kapiv1.Pod) bool

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

func CheckPodIsRunning

func CheckPodIsRunning(pod kapiv1.Pod) bool

CheckPodIsRunning returns true if the pod is running

func CheckPodIsSucceeded

func CheckPodIsSucceeded(pod kapiv1.Pod) bool

CheckPodIsSucceeded returns true if the pod status is "Succdeded"

func CheckPodNoOp

func CheckPodNoOp(pod kapiv1.Pod) bool

CheckPodNoOp always returns true

func CreateExecPodOrFail

func CreateExecPodOrFail(client corev1client.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 CreateNsResourceFromTemplate

func CreateNsResourceFromTemplate(c *CLI, namespace string, filepath string) (string, error)

CreateNsResourceFromTemplate create ns resource from the template. No need to add a namespace parameter in the template file as it can be provided as a function argument. For ex: CreateNsResourceFromTemplate(c, "NAMESPACE", "TEMPLATE_FILE")

func CreateNsResourceFromTemplateWithVariables

func CreateNsResourceFromTemplateWithVariables(c *CLI, namespace string, filepath string, variables map[string]string) (string, error)

CreateNsResourceFromTemplateWithVariables create ns resource from the template. No need to add a namespace parameter in the template file as it can be provided as a function argument. For ex: CreateNsResourceFromTemplateWithVariables(c, "NAMESPACE", "TEMPLATE_FILE", map{"VAR_1":"VALUE_1"})

func CreateResourceFromTemplate

func CreateResourceFromTemplate(c *CLI, filepath string) (string, error)

CreateResourceFromTemplate create resource from the template. For ex: CreateResourceFromTemplate(c, "TEMPLATE_FILE")

func CreateResourceFromTemplateWithVariables

func CreateResourceFromTemplateWithVariables(c *CLI, filepath string, variables map[string]string) (string, error)

CreateResourceFromTemplateWithVariables create resource from the template. For ex: CreateResourceFromTemplateWithVariables(c, "TEMPLATE_FILE", map{"VAR_1":"VALUE_1"})

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

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 DumpConfigMapStates

func DumpConfigMapStates(oc *CLI)

DumpConfigMapStates dumps the state of all ConfigMaps in the CLI's current namespace.

func DumpDeploymentLogs

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

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

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 DumpPodLogs

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

func DumpPodLogsStartingWith

func DumpPodLogsStartingWith(prefix string, oc *CLI)

DumpPodLogsStartingWith will dump any pod starting with the name prefix provided

func DumpPodLogsStartingWithInNamespace

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

DumpPodLogsStartingWith will dump any pod starting with the name prefix provided

func DumpPodStates

func DumpPodStates(oc *CLI)

DumpPodStates dumps the state of all pods in the CLI's current namespace.

func DumpPodStatesInNamespace

func DumpPodStatesInNamespace(namespace string, oc *CLI)

DumpPodStatesInNamespace dumps the state of all pods in the provided namespace.

func DumpPodsCommand

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 DumpSampleOperator

func DumpSampleOperator(oc *CLI)

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 ginkgo.GinkgoTestingT, suite string)

func FatalErr

func FatalErr(msg interface{})

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

func FetchURL

func FetchURL(oc *CLI, url string, retryTimeout time.Duration) (string, 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 FileExist

func FileExist(path string) bool

FileExist checks whether file is exist returns bool

func FindCLIImage

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

func FindImageFormatString

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

FindImageFormatString returns a format string for components on the cluster. It returns false if no format string could be inferred from the cluster. OpenShift 4.0 clusters will not be able to infer an image format string, so you must wrap this method in one that can locate your specific image.

func FindRouterImage

func FindRouterImage(oc *CLI) (string, error)

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 GenerateOAuthTokenPair

func GenerateOAuthTokenPair() (privToken, pubToken string)

GenerateOAuthTokenPair returns two tokens to use with OpenShift OAuth-based authentication. The first token is a private token meant to be used as a Bearer token to send queries to the API, the second token is a hashed token meant to be stored in the database.

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 imagev1typedclient.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 GetKcpServerGitCommit

func GetKcpServerGitCommit(k *CLI) (string, error)

GetKcpServerGitCommit gets the kcp server gitCommit

func GetKcpServerVersion

func GetKcpServerVersion(k *CLI) (string, error)

GetKcpServerVersion gets the kcp server version

func GetMasterThreadDump

func GetMasterThreadDump(oc *CLI)

GetMasterThreadDump will get a golang thread stack dump

func GetParentWsServerURL

func GetParentWsServerURL(serverURL string) string

GetParentWsServerURL returns the parentServer of the input server URL

func GetPodForContainer

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

GetPodForContainer creates a new Pod that runs specified container

func GetPodNamesByFilter

func GetPodNamesByFilter(c corev1client.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 GetRandomString

func GetRandomString() string

GetRandomString use for getting a 8 byte random string

func GetRouterPodTemplate

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

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

func InitDefaultEnvironmentVariables

func InitDefaultEnvironmentVariables()

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 InitStandardFlags

func InitStandardFlags()

func InitTest

func InitTest(dryRun bool) error

func IsClusterOperated

func IsClusterOperated(oc *CLI) bool

func IsDebug

func IsDebug() bool

IsDebug use for check whether the E2E_TEST "DEBUG" log enabled

func IsInMap

func IsInMap(inputMap map[string]struct{}, inputString string) bool

IsInMap use for checking whether the map contains specified key

func KubeConfigPath

func KubeConfigPath() string

KubeConfigPath returns the value of KUBECONFIG environment variable

func LaunchWebserverPod

func LaunchWebserverPod(f *e2e.Framework, podName, nodeName string) (ip string)

LaunchWebserverPod launches a pod serving http on port 8080 to act as the target for networking connectivity checks. The ip address of the created pod will be returned if the pod is launched successfully.

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 ParseFileVariables

func ParseFileVariables(original_filepath string, args map[string]string) string

ParseFileVariables parse the given file and return a new file with its variables being replaced

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 PreCheckEnvSupport

func PreCheckEnvSupport(k *CLI, envFlags ...string) error

PreCheckEnvSupport checks the environment satisfy test suits

func PreTestDump

func PreTestDump()

func ReadKubeConfig

func ReadKubeConfig(kubeconfigPath string) string

ReadKubeConfig returns a specific kubeconfig to JSON

func RunOneShotCommandPod

func RunOneShotCommandPod(
	oc *CLI,
	name, image, command string,
	volumeMounts []corev1.VolumeMount,
	volumes []corev1.Volume,
	env []corev1.EnvVar,
	timeout time.Duration,
) (string, []error)

RunOneShotCommandPod runs the given command in a pod and waits for completion and log output for the given timeout duration, returning the command output or an error. TODO: merge with the PodExecutor above

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 StrSliceContains

func StrSliceContains(sl []string, element string) bool

StrSliceContains use for checking whether the String Slice contains specified element, return bool

func StrSliceContainsDuplicate

func StrSliceContainsDuplicate(strings []string) bool

StrSliceContainsDuplicate use for checking whether string slice contains duplicate string

func StrSliceIntersect

func StrSliceIntersect(slice1, slice2 []string) []string

StrSliceIntersect use for none duplicate elements slice intersect

func StrSliceToIntSlice

func StrSliceToIntSlice(strSlice []string) ([]int, []error)

StrSliceToIntSlice use for converting strings slice to integer slice

func StrSliceToMap

func StrSliceToMap(strSlice []string) map[string]struct{}

StrSliceToMap use for converting String Slice to Map: map[string]struct{}

func StructMarshalOutputToFile

func StructMarshalOutputToFile(customStruct interface{}, filename string) (string, error)

StructMarshalOutputToFile executes the command and store output to a file

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 VersionIsAbove

func VersionIsAbove(versionA, versionB string) bool

VersionIsAbove use for comparing 2 different versions versionA, versionB should be the same length E.g. [{versionA: "0.6.1", versionB: "0.5.0"}, {versionA: "0.7.0", versionB: "0.6.2"}] IF versionA above versionB return "bool:true" ELSE return "bool:false" (Contains versionA = versionB)

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 batchv1client.JobInterface, name string, timeout time.Duration) error

func WaitForAnImageStream

func WaitForAnImageStream(client imagev1typedclient.ImageStreamInterface,
	name string,
	isOK, isFailed func(*imagev1.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 WaitForEndpoint

func WaitForEndpoint(c kclientset.Interface, ns, name string) error

func WaitForInternalRegistryHostname

func WaitForInternalRegistryHostname(oc *CLI) (string, error)

WaitForInternalRegistryHostname waits for the internal registry hostname to be made available to the cluster.

func WaitForOpenShiftNamespaceImageStreams

func WaitForOpenShiftNamespaceImageStreams(oc *CLI) error

WaitForOpenShiftNamespaceImageStreams waits for the standard set of imagestreams to be imported

func WaitForPods

func WaitForPods(c corev1client.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 WaitForResourceQuotaSync

func WaitForResourceQuotaSync(
	client corev1client.ResourceQuotaInterface,
	name string,
	expectedUsage corev1.ResourceList,
	expectedIsUpperLimit bool,
	timeout time.Duration,
) (corev1.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

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

func WaitForServiceAccount

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

WaitForServiceAccount waits until the named service account gets fully provisioned

func WaitForUserBeAuthorized

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 WaitSpecificAPISyncedInSpecificWorkSpace

func WaitSpecificAPISyncedInSpecificWorkSpace(k *CLI, specificAPI string, specificWsURL string)

WaitSpecificAPISyncedInSpecificWorkSpace waits the specific api-resource synced in specific workspace

func WaitUntilPodIsGone

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

WaitUntilPodIsGone waits until the named Pod will disappear

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.

func (*BuildResult) LogsNoTimestamp

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

LogsNoTimestamp 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 NewCLIWithWorkSpace

func NewCLIWithWorkSpace(wsPrefix string) *CLI

NewCLIWithWorkSpace initialize the upstream E2E framework with adding a workspace. You may also call SetupWorkSpace() to create a new one. The workspace named "e2e-test-"" + wsPrefix + 5Bytes random string E.g. e2e-test-kcp-workspace-bfzjr

func (*CLI) AddExplicitResourceToDelete

func (c *CLI) AddExplicitResourceToDelete(resource schema.GroupVersionResource, namespace, name string)

AddExplicitResourceToDelete method

func (*CLI) AddResourceToDelete

func (c *CLI) AddResourceToDelete(resource schema.GroupVersionResource, metadata metav1.Object)

AddResourceToDelete method

func (*CLI) AdminAppsClient

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

AdminAppsClient method

func (*CLI) AdminAuthorizationClient

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

AdminAuthorizationClient method

func (*CLI) AdminBuildClient

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

AdminBuildClient method

func (*CLI) AdminConfig

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

AdminConfig method

func (*CLI) AdminConfigClient

func (c *CLI) AdminConfigClient() configv1client.Interface

AdminConfigClient method

func (*CLI) AdminDynamicClient

func (c *CLI) AdminDynamicClient() dynamic.Interface

AdminDynamicClient method

func (*CLI) AdminImageClient

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

AdminImageClient method

func (*CLI) AdminKubeClient

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

AdminKubeClient provides a Kubernetes client for the cluster admin user.

func (*CLI) AdminOAuthClient

func (c *CLI) AdminOAuthClient() oauthv1client.Interface

AdminOAuthClient method

func (*CLI) AdminOauthClient

func (c *CLI) AdminOauthClient() oauthv1client.Interface

AdminOauthClient method

func (*CLI) AdminOperatorClient

func (c *CLI) AdminOperatorClient() operatorv1client.Interface

AdminOperatorClient method

func (*CLI) AdminProjectClient

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

AdminProjectClient method

func (*CLI) AdminQuotaClient

func (c *CLI) AdminQuotaClient() quotav1client.Interface

AdminQuotaClient method

func (*CLI) AdminRouteClient

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

AdminRouteClient method

func (*CLI) AdminSecurityClient

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

AdminSecurityClient method

func (*CLI) AdminTemplateClient

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

AdminTemplateClient method

func (*CLI) AdminUserClient

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

AdminUserClient method

func (*CLI) AppsClient

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

AppsClient method

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) AsPClusterKubeconf

func (c CLI) AsPClusterKubeconf() *CLI

AsPClusterKubeconf instructs the command should take kubeconfig of the pcluster

func (*CLI) AuthorizationClient

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

AuthorizationClient method

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

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

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

BuildClient method

func (*CLI) ChangeUser

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

ChangeUser changes the user used by the current CLI session.

func (*CLI) CreateProject

func (c *CLI) CreateProject() string

CreateProject creates a new project and assign a random user to the project. All resources will be then created within this project. TODO this should be removed. It's only used by image tests.

func (*CLI) CreateUser

func (c *CLI) CreateUser(prefix string) *userv1.User

CreateUser method

func (*CLI) DynamicClient

func (c *CLI) DynamicClient() dynamic.Interface

DynamicClient method

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) GetClientConfigForUser

func (c *CLI) GetClientConfigForUser(username string) *rest.Config

GetClientConfigForUser method

func (*CLI) HomeServerURL

func (c *CLI) HomeServerURL() string

HomeServerURL returns the user home workspace server url.

func (*CLI) ImageClient

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

ImageClient method

func (*CLI) InputString

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

InputString adds expected input to the command

func (*CLI) KubeClient

func (c *CLI) KubeClient() kubernetes.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) ListWorkSpacesWithSpecificPath

func (c *CLI) ListWorkSpacesWithSpecificPath(serverURL string) []string

ListWorkSpacesWithSpecificPath returns a list of WorkSpaces under a specific workspace

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) NotShowInfo

func (c *CLI) NotShowInfo() *CLI

NotShowInfo instructs the command will not be logged

func (*CLI) OrgServerURL

func (c *CLI) OrgServerURL() string

OrgServerURL returns the user organization workspace server url.

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) OutputsToFiles

func (c *CLI) OutputsToFiles(fileName string) (string, string, error)

OutputsToFiles executes the command and store the stdout in one file and stderr in another one The stdout output will be written to fileName+'.stdout' The stderr output will be written to fileName+'.stderr'

func (*CLI) ProjectClient

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

ProjectClient method

func (*CLI) QuotaClient

func (c *CLI) QuotaClient() quotav1client.Interface

QuotaClient method

func (*CLI) RESTMapper

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

RESTMapper method

func (*CLI) RouteClient

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

RouteClient method

func (*CLI) Run

func (c *CLI) Run(command string, flags ...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) SetPClusterKubeconf

func (c *CLI) SetPClusterKubeconf(pClusterConfigPath string) *CLI

SetPClusterKubeconf instructs the pcluster kubeconf file is set

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) SetupWorkSpace

func (c *CLI) SetupWorkSpace()

SetupWorkSpace creates a new WorkSpace under the org workspace

func (*CLI) SetupWorkSpaceWithNamespace

func (c *CLI) SetupWorkSpaceWithNamespace()

SetupWorkSpaceWithNamespace creates a new WorkSpace under the user's home workspace and creates a namespace under the WorkSpace

func (*CLI) SetupWorkSpaceWithSpecificPath

func (c *CLI) SetupWorkSpaceWithSpecificPath(serverURL string)

SetupWorkSpaceWithSpecificPath creates a new WorkSpace with specific paths

func (*CLI) TeardownProject

func (c *CLI) TeardownProject()

TeardownProject removes projects created by this test.

func (*CLI) TeardownWorkSpace

func (c *CLI) TeardownWorkSpace()

TeardownWorkSpace removes workspaces created by this test.

func (*CLI) Template

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

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

func (*CLI) TemplateClient

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

TemplateClient method

func (*CLI) UserConfig

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

UserConfig method

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) WaitForAccessAllowed

func (c *CLI) WaitForAccessAllowed(review *kubeauthorizationv1.SelfSubjectAccessReview, user string) error

WaitForAccessAllowed method

func (*CLI) WaitForAccessDenied

func (c *CLI) WaitForAccessDenied(review *kubeauthorizationv1.SelfSubjectAccessReview, user string) error

WaitForAccessDenied method

func (*CLI) WithOrgWorkSpaceServer

func (c *CLI) WithOrgWorkSpaceServer() *CLI

WithOrgWorkSpaceServer replaces the current workspace with org organization workspace.

func (*CLI) WithSpecificWorkSpaceServer

func (c *CLI) WithSpecificWorkSpaceServer(ws WorkSpace) *CLI

WithSpecificWorkSpaceServer replaces the current workspace with specific workspace.

func (CLI) WithoutKubeconf

func (c CLI) WithoutKubeconf() *CLI

WithoutKubeconf instructs the command should be invoked without adding --kubeconfig parameter

func (CLI) WithoutNamespace

func (c CLI) WithoutNamespace() *CLI

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

func (CLI) WithoutWorkSpaceServer

func (c CLI) WithoutWorkSpaceServer() *CLI

WithoutWorkSpaceServer instructs the command should be invoked without adding --server parameter

func (*CLI) WorkSpace

func (c *CLI) WorkSpace() WorkSpace

WorkSpace returns the workspace used in the current test case.

type DeployOption

type DeployOption func(*Deployment)

DeployOption uses function option mode to change the default value of deployment parameters, E.g. name, namespace, replicas etc.

func SetDeploymentAppLabel

func SetDeploymentAppLabel(appLabel string) DeployOption

SetDeploymentAppLabel sets the deployment's appLabel

func SetDeploymentImage

func SetDeploymentImage(image string) DeployOption

SetDeploymentImage sets the deployment's image

func SetDeploymentName

func SetDeploymentName(name string) DeployOption

SetDeploymentName sets the deployment's name

func SetDeploymentNameSpace

func SetDeploymentNameSpace(namespace string) DeployOption

SetDeploymentNameSpace sets the deployment's namespace

func SetDeploymentReplicas

func SetDeploymentReplicas(replicas string) DeployOption

SetDeploymentReplicas sets the deployment's replicas

type Deployment

type Deployment struct {
	Name      string
	Namespace string
	Replicas  string
	AppLabel  string
	Image     string
}

Deployment struct definition

func NewDeployment

func NewDeployment(opts ...DeployOption) Deployment

NewDeployment creates a new customized deployment object

func (*Deployment) CheckDisplayColumns

func (dep *Deployment) CheckDisplayColumns(k *CLI)

CheckDisplayColumns checks the deployment info showing the expected columns

func (*Deployment) CheckReady

func (dep *Deployment) CheckReady(k *CLI) (bool, error)

CheckReady checks whether the deployment is ready

func (*Deployment) Clean

func (dep *Deployment) Clean(k *CLI) error

Clean the deployment resource

func (*Deployment) Create

func (dep *Deployment) Create(k *CLI)

Create the deployment

func (*Deployment) Delete

func (dep *Deployment) Delete(k *CLI)

Delete the deployment

func (*Deployment) Describe

func (dep *Deployment) Describe(k *CLI) (string, error)

Describe the deployment

func (*Deployment) GetFieldByJSONPath

func (dep *Deployment) GetFieldByJSONPath(k *CLI, JSONPath string) (string, error)

GetFieldByJSONPath gets specific field value of the deployment by jsonpath

func (*Deployment) GetPclusterDeploy

func (dep *Deployment) GetPclusterDeploy(k *CLI) (pDeploy *Deployment)

GetPclusterDeploy gets the deployment synced to pcluster object

func (*Deployment) GetReplicasNum

func (dep *Deployment) GetReplicasNum(k *CLI) string

GetReplicasNum gets replicas of the deployment

func (*Deployment) ScaleReplicas

func (dep *Deployment) ScaleReplicas(k *CLI, replicasNum string)

ScaleReplicas scales the deployment's replicas number

func (*Deployment) WaitUntilReady

func (dep *Deployment) WaitUntilReady(k *CLI)

WaitUntilReady waits the deployment become ready

type ExitError

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

ExitError struct

type GitRepo

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

func NewGitRepo

func NewGitRepo(repoName string) (GitRepo, error)

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

func (GitRepo) AddAndCommit

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

AddAndCommit commits a file with its content to local repo

func (GitRepo) Remove

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 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)

type WorkSpace

type WorkSpace struct {
	Name             string   // WorkSpace Name                                                E.g. e2e-test-kcp-workspace-xxxxx
	CurrentNameSpace string   // The latest workSpace's namespace created by SetupNameSpace()  E.g. e2e-ns-kcp-workspace-xxxxx
	Namespaces       []string // WorkSpace's Namespaces created by SetupNameSpace()            E.g. e2e-ns-kcp-workspace-xxxxx
	ServerURL        string   // WorkSpace ServerURL                                           E.g. https://{{kcp-service-domain}}/clusters/root:orgID:e2e-test-kcp-workspace-xxxxx
	ParentServerURL  string   // WorkSpace ParentServerURL                                     E.g. https://{{kcp-service-domain}}/clusters/root:orgID
}

WorkSpace definition

func (*WorkSpace) SetNamespace

func (ws *WorkSpace) SetNamespace(c *CLI)

SetNamespace creates a new namespace with name in the format of "e2e-ns-"" + basename + 5Bytes random string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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