mock

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClientset

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

FakeClientset creates a fake-client to simulate the remote-execution (exec) against a pod. It simulates the low level Kubernetes API calls in order to intercept stdin, stdout and stderr sent back to the client.

func NewFakeClientset

func NewFakeClientset(pod *corev1.Pod) *FakeClientset

NewFakeClientset instantiate fake client with informed pod.

func (*FakeClientset) Clientset

func (f *FakeClientset) Clientset() *kubernetes.Clientset

Clientset exposes the clientset attribute.

func (*FakeClientset) RESTConfig

func (f *FakeClientset) RESTConfig() *rest.Config

RESTConfig exposes the restConfig attribute.

type FakeRemoteExecutor

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

FakeRemoteExecutor implements exec.RemoteExecutor interface, part of `kubectl exec` subcommand, capturing Execute method input.

func NewFakeRemoteExecutor

func NewFakeRemoteExecutor(err error) *FakeRemoteExecutor

NewFakeRemoteExecutor instantiate a FakeRemoteExecutor with stubbed error.

func (*FakeRemoteExecutor) Command

func (f *FakeRemoteExecutor) Command() []string

Command returns the command informed to Execute.

func (*FakeRemoteExecutor) Execute

func (f *FakeRemoteExecutor) Execute(
	_ string,
	reqURL *url.URL,
	_ *rest.Config,
	stdin io.Reader,
	_, _ io.Writer,
	_ bool,
	_ remotecommand.TerminalSizeQueue,
) error

Execute handles the actual http request against Kubernetes API, and here greatly simplified to only return a stubbed error, and extract elements from the request.

func (*FakeRemoteExecutor) Stdin

func (f *FakeRemoteExecutor) Stdin() string

Stdin returns as string the stdin informed to Execute.

Jump to

Keyboard shortcuts

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