managedfieldstest

package
v0.32.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeFieldManager added in v0.28.0

func NewFakeFieldManager(typeConverter managedfields.TypeConverter, gvk schema.GroupVersionKind) *managedfields.FieldManager

NewFakeFieldManager creates an actual FieldManager but that doesn't perform any conversion. This is just a convenience for tests to create an actual manager that they can use but in very restricted ways.

This is different from the TestFieldManager because it's not meant to assert values, or hold the state, this acts like a normal FieldManager.

Also, this only operates on the main-resource, and sub-resource can't be configured.

Types

type TestFieldManager

type TestFieldManager interface {
	// APIVersion of the object that we're tracking.
	APIVersion() string
	// Reset resets the state of the liveObject by resetting it to an empty object.
	Reset()
	// Live returns a copy of the current liveObject.
	Live() runtime.Object
	// Apply applies the given object on top of the current liveObj, for the
	// given manager and force flag.
	Apply(obj runtime.Object, manager string, force bool) error
	// Update will updates the managed fields in the liveObj based on the
	// changes performed by the update.
	Update(obj runtime.Object, manager string) error
	// ManagedFields returns the list of existing managed fields for the
	// liveObj.
	ManagedFields() []metav1.ManagedFieldsEntry
}

TestFieldManager is a FieldManager that can be used in test to simulate the behavior of Server-Side Apply and field tracking. This also has a few methods to get a sense of the state of the object.

This TestFieldManager uses a series of "fake" objects to simulate some behavior which come with the limitation that you can only use one version since there is no version conversion logic.

You can use this rather than NewDefaultTestFieldManager if you want to specify either a sub-resource, or a set of modified Manager to test them specifically.

func NewTestFieldManager

func NewTestFieldManager(typeConverter managedfields.TypeConverter, gvk schema.GroupVersionKind) TestFieldManager

NewTestFieldManager returns a new TestFieldManager built for the given gvk, on the main resource.

func NewTestFieldManagerSubresource

func NewTestFieldManagerSubresource(typeConverter managedfields.TypeConverter, gvk schema.GroupVersionKind, subresource string) TestFieldManager

NewTestFieldManagerSubresource returns a new TestFieldManager built for the given gvk, on the given sub-resource.

Jump to

Keyboard shortcuts

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