fake

package
v3.5.6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fake implements various fake KubeClients for use in testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FailingKubeClient

type FailingKubeClient struct {
	PrintingKubeClient
	CreateError                      error
	WaitError                        error
	DeleteError                      error
	WatchUntilReadyError             error
	UpdateError                      error
	BuildError                       error
	BuildUnstructuredError           error
	WaitAndGetCompletedPodPhaseError error
}

FailingKubeClient implements KubeClient for testing purposes. It also has additional errors you can set to fail different functions, otherwise it delegates all its calls to `PrintingKubeClient`

func (*FailingKubeClient) Build

Build returns the configured error if set or prints

func (*FailingKubeClient) Create

func (f *FailingKubeClient) Create(resources kube.ResourceList) (*kube.Result, error)

Create returns the configured error if set or prints

func (*FailingKubeClient) Delete

func (f *FailingKubeClient) Delete(resources kube.ResourceList) (*kube.Result, []error)

Delete returns the configured error if set or prints

func (*FailingKubeClient) Update

func (f *FailingKubeClient) Update(r, modified kube.ResourceList, ignoreMe bool) (*kube.Result, error)

Update returns the configured error if set or prints

func (*FailingKubeClient) Wait

func (f *FailingKubeClient) Wait(resources kube.ResourceList, d time.Duration) error

Wait returns the configured error if set or prints

func (*FailingKubeClient) WaitAndGetCompletedPodPhase

func (f *FailingKubeClient) WaitAndGetCompletedPodPhase(s string, d time.Duration) (v1.PodPhase, error)

WaitAndGetCompletedPodPhase returns the configured error if set or prints

func (*FailingKubeClient) WaitWithJobs

func (f *FailingKubeClient) WaitWithJobs(resources kube.ResourceList, d time.Duration) error

WaitWithJobs returns the configured error if set or prints

func (*FailingKubeClient) WatchUntilReady

func (f *FailingKubeClient) WatchUntilReady(resources kube.ResourceList, d time.Duration) error

WatchUntilReady returns the configured error if set or prints

type PrintingKubeClient

type PrintingKubeClient struct {
	Out io.Writer
}

PrintingKubeClient implements KubeClient, but simply prints the reader to the given output.

func (*PrintingKubeClient) Build

Build implements KubeClient Build.

func (*PrintingKubeClient) Create

func (p *PrintingKubeClient) Create(resources kube.ResourceList) (*kube.Result, error)

Create prints the values of what would be created with a real KubeClient.

func (*PrintingKubeClient) Delete

func (p *PrintingKubeClient) Delete(resources kube.ResourceList) (*kube.Result, []error)

Delete implements KubeClient delete.

It only prints out the content to be deleted.

func (*PrintingKubeClient) IsReachable

func (p *PrintingKubeClient) IsReachable() error

IsReachable checks if the cluster is reachable

func (*PrintingKubeClient) Update

func (p *PrintingKubeClient) Update(_, modified kube.ResourceList, _ bool) (*kube.Result, error)

Update implements KubeClient Update.

func (*PrintingKubeClient) Wait

func (p *PrintingKubeClient) Wait(resources kube.ResourceList, _ time.Duration) error

func (*PrintingKubeClient) WaitAndGetCompletedPodPhase

func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(_ string, _ time.Duration) (v1.PodPhase, error)

WaitAndGetCompletedPodPhase implements KubeClient WaitAndGetCompletedPodPhase.

func (*PrintingKubeClient) WaitWithJobs

func (p *PrintingKubeClient) WaitWithJobs(resources kube.ResourceList, _ time.Duration) error

func (*PrintingKubeClient) WatchUntilReady

func (p *PrintingKubeClient) WatchUntilReady(resources kube.ResourceList, _ time.Duration) error

WatchUntilReady implements KubeClient WatchUntilReady.

Jump to

Keyboard shortcuts

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