kubernetesk8s.io/kubernetes/test/e2e/framework/pod/output Index | Files

package output

import "k8s.io/kubernetes/test/e2e/framework/pod/output"

Index

Constants

const (
	// Poll is how often to Poll pods, nodes and claims.
	Poll = 2 * time.Second
)

DEPRECATED constants. Use the timeouts in framework.Framework instead.

Functions

func CreateEmptyFileOnPod

func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error

CreateEmptyFileOnPod creates empty file at given path on the pod.

func DumpDebugInfo

func DumpDebugInfo(ctx context.Context, c clientset.Interface, ns string)

DumpDebugInfo dumps debug info of tests.

func LookForStringInLog

func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error)

LookForStringInLog looks for the given string in the log of a specific pod container

func LookForStringInLogWithoutKubectl

func LookForStringInLogWithoutKubectl(ctx context.Context, client clientset.Interface, ns string, podName string, container string, expectedString string, timeout time.Duration) (result string, err error)

LookForStringInLogWithoutKubectl looks for the given string in the log of a specific pod container

func LookForStringInPodExec

func LookForStringInPodExec(ns, podName string, command []string, expectedString string, timeout time.Duration) (result string, err error)

LookForStringInPodExec looks for the given string in the output of a command executed in the first container of specified pod.

func LookForStringInPodExecToContainer

func LookForStringInPodExecToContainer(ns, podName, containerName string, command []string, expectedString string, timeout time.Duration) (result string, err error)

LookForStringInPodExecToContainer looks for the given string in the output of a command executed in specified pod container, or first container if not specified.

func MatchContainerOutput

func MatchContainerOutput(
	ctx context.Context,
	f *framework.Framework,
	pod *v1.Pod,
	containerName string,
	expectedOutput []string,
	matcher func(string, ...interface{}) gomegatypes.GomegaMatcher) error

MatchContainerOutput creates a pod and waits for all it's containers to exit with success. It then tests that the matcher with each expectedOutput matches the output of the specified container.

func MatchMultipleContainerOutputs

func MatchMultipleContainerOutputs(
	ctx context.Context,
	f *framework.Framework,
	pod *v1.Pod,
	expectedOutputs map[string][]string,
	matcher func(string, ...interface{}) gomegatypes.GomegaMatcher) error

func RunHostCmd

func RunHostCmd(ns, name, cmd string) (string, error)

RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.

func RunHostCmdOrDie

func RunHostCmdOrDie(ns, name, cmd string) string

RunHostCmdOrDie calls RunHostCmd and dies on error.

func RunHostCmdWithFullOutput

func RunHostCmdWithFullOutput(ns, name, cmd string) (string, string, error)

RunHostCmdWithFullOutput runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell. It will also return the command's stderr.

func RunHostCmdWithRetries

func RunHostCmdWithRetries(ns, name, cmd string, interval, timeout time.Duration) (string, error)

RunHostCmdWithRetries calls RunHostCmd and retries all errors until it succeeds or the specified timeout expires. This can be used with idempotent commands to deflake transient Node issues.

func TestContainerOutput

func TestContainerOutput(ctx context.Context, f *framework.Framework, scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)

TestContainerOutput runs the given pod in the given namespace and waits for all of the containers in the podSpec to move into the 'Success' status, and tests the specified container log against the given expected output using a substring matcher.

func TestContainerOutputMatcher

func TestContainerOutputMatcher(ctx context.Context, f *framework.Framework,
	scenarioName string,
	pod *v1.Pod,
	containerIndex int,
	expectedOutput []string,
	matcher func(string, ...interface{}) gomegatypes.GomegaMatcher)

TestContainerOutputMatcher runs the given pod in the given namespace and waits for all of the containers in the podSpec to move into the 'Success' status, and tests the specified container log against the given expected output using the given matcher.

func TestContainerOutputRegexp

func TestContainerOutputRegexp(ctx context.Context, f *framework.Framework, scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)

TestContainerOutputRegexp runs the given pod in the given namespace and waits for all of the containers in the podSpec to move into the 'Success' status, and tests the specified container log against the given expected output using a regexp matcher.

func TestContainerOutputsMatcher

func TestContainerOutputsMatcher(ctx context.Context, f *framework.Framework,
	scenarioName string,
	pod *v1.Pod,
	expectedOutputs map[int][]string,
	matcher func(string, ...interface{}) gomegatypes.GomegaMatcher)

func TestContainerOutputsRegexp

func TestContainerOutputsRegexp(ctx context.Context, f *framework.Framework, scenarioName string, pod *v1.Pod, expectedOutputs map[int][]string)

Source Files

output.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
6 hours ago

Tools for package owners.