Documentation ¶
Index ¶
- type Suite
- func (ts *Suite) DeleteResources(resources ...client.Object)
- func (ts *Suite) EnsureNS(nsName string)
- func (ts *Suite) EnsureResources(resources ...client.Object)
- func (ts *Suite) FetchResource(name types.NamespacedName, object client.Object)
- func (ts *Suite) FetchResources(objectList client.ObjectList, opts ...client.ListOption)
- func (ts *Suite) MapToRequest(object metav1.Object) ctrl.Request
- func (ts *Suite) NewNS(nsName string) *corev1.Namespace
- func (ts *Suite) RegisterScheme(addToScheme func(s *runtime.Scheme) error)
- func (ts *Suite) SanitizeNameForNS(name string) string
- func (ts *Suite) SetupSuite()
- func (ts *Suite) TearDownSuite()
- func (ts *Suite) UpdateResources(resources ...client.Object)
- func (ts *Suite) UpdateStatus(resources ...client.Object)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Suite ¶
type Suite struct { suite.Suite NS string Client client.Client Config *rest.Config Env *envtest.Environment Logger logr.Logger Context context.Context Scheme *runtime.Scheme }
Suite is the common test suite for integration tests using envtest. It's expected that concrete suites use this suite as the base.
func (*Suite) DeleteResources ¶
DeleteResources deletes the given resources are updated from the suite. Each error will fail the test.
func (*Suite) EnsureResources ¶
EnsureResources ensures that the given resources are existing in the suite. Each error will fail the test.
func (*Suite) FetchResource ¶
func (ts *Suite) FetchResource(name types.NamespacedName, object client.Object)
FetchResource fetches the given object name and stores the result in the given object. Test fails on errors.
func (*Suite) FetchResources ¶
func (ts *Suite) FetchResources(objectList client.ObjectList, opts ...client.ListOption)
FetchResources fetches resources and puts the items into the given list with the given list options. Test fails on errors.
func (*Suite) MapToRequest ¶
MapToRequest maps the given object into a reconcile Request.
func (*Suite) NewNS ¶
NewNS returns a new Namespace object with the given name. Note: The namespace is not actually created, use EnsureNS for this.
func (*Suite) RegisterScheme ¶
RegisterScheme passes the current scheme to the given SchemeBuilder func.
func (*Suite) SanitizeNameForNS ¶
SanitizeNameForNS first converts the given name to lowercase using strings.ToLower and then remove all characters but `a-z` (only lower case), `0-9` and the `-` (dash).
func (*Suite) SetupSuite ¶
func (ts *Suite) SetupSuite()
SetupSuite implements suite.SetupAllSuite. It is run before running all the tests in the suite and is used to start up a local Kubernetes API server.
func (*Suite) TearDownSuite ¶
func (ts *Suite) TearDownSuite()
TearDownSuite implements suite.TearDownAllSuite. It is used to shut down the local envtest environment.
func (*Suite) UpdateResources ¶
UpdateResources ensures that the given resources are updated in the suite. Each error will fail the test.
func (*Suite) UpdateStatus ¶
UpdateStatus ensures that the Status property of the given resources are updated in the suite. Each error will fail the test.