test

package
v1.102.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsistOfConfigFuncs added in v1.11.0

func ConsistOfConfigFuncs(fns ...any) gomegatypes.GomegaMatcher

ConsistOfConfigFuncs returns a composed `ConsistsOf` matcher with `MatchConfigFunc` for each ConfigFn in `fns`. This is useful for making assertions on a given slice of ConfigFns which can't be compared by value. e.g.:

Expect(fns).To(kubernetes.ConsistOfConfigFuncs(
	kubernetes.WithClientConnectionOptions(clientConnectionConfig),
	kubernetes.WithClientOptions(clientOptions),
	kubernetes.WithDisabledCachedClient(),
))

func MatchConfigFunc added in v1.11.0

func MatchConfigFunc(fn any) gomegatypes.GomegaMatcher

MatchConfigFunc returns a matcher that checks if the config produced by the actual ConfigFn is deeply equal to the config produced by `fn`. This is useful for making assertions on given ConfigFns which can't be compared by value. e.g.:

Expect(fn).Should(MatchConfigFunc(WithClientConnectionOptions(clientConnectionConfig)))

func NewTestApplier

func NewTestApplier(c client.Client, discovery discovery.DiscoveryInterface) (kubernetes.Applier, error)

NewTestApplier creates a new fake applier.

Types

type ClientSet added in v1.7.0

ClientSet implements k8s.io/client-go/kubernetes.Interface but allows to use a fake discovery client.

func NewClientSetWithDiscovery added in v1.8.0

func NewClientSetWithDiscovery(kubernetes kubernetesclientset.Interface, discovery discovery.DiscoveryInterface) *ClientSet

NewClientSetWithDiscovery allows to easily fake calls to kubernetes.Interface.Discovery() by using the given discovery interface.

func NewClientSetWithFakedServerVersion added in v1.7.0

func NewClientSetWithFakedServerVersion(kubernetes kubernetesclientset.Interface, version *version.Info) *ClientSet

NewClientSetWithFakedServerVersion allows to easily fake calls to kubernetes.Interface.Discovery().ServerVersion() by using the given version.

func (*ClientSet) Discovery added in v1.7.0

func (c *ClientSet) Discovery() discovery.DiscoveryInterface

Discovery returns the discovery interface of this client set.

type FakeDiscovery

type FakeDiscovery struct {
	*fakediscovery.FakeDiscovery

	GroupListFn   func() *metav1.APIGroupList
	ResourceMapFn func() map[string]*metav1.APIResourceList
	// contains filtered or unexported fields
}

FakeDiscovery is used to tests, more specifically - chart applier.

func (*FakeDiscovery) ServerGroups

func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error)

ServerGroups return group lists from ResourceMapFn

func (*FakeDiscovery) ServerResourcesForGroupVersion

func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)

ServerResourcesForGroupVersion returns resource lists from ResourceMapFn

func (*FakeDiscovery) ServerVersion

func (c *FakeDiscovery) ServerVersion() (*version.Info, error)

ServerVersion return empty version.

Jump to

Keyboard shortcuts

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