Documentation
¶
Index ¶
- Variables
- type AssertFunc
- 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) IsResourceExisting(ctx context.Context, obj client.Object) bool
- func (ts *Suite) MapToRequest(object metav1.Object) ctrl.Request
- func (ts *Suite) NewNS(nsName string) *corev1.Namespace
- func (ts *Suite) RepeatedAssert(timeout time.Duration, interval time.Duration, failureMsg string, ...)
- func (ts *Suite) SanitizeNameForNS(name string) string
- func (ts *Suite) SetCondition(resource client.Object, conditions *[]metav1.Condition, ...)
- func (ts *Suite) SetupSuite()
- func (ts *Suite) SetupTest()
- func (ts *Suite) TearDownSuite()
- func (ts *Suite) UpdateResources(resources ...client.Object)
- func (ts *Suite) UpdateStatus(resources ...client.Object)
Constants ¶
This section is empty.
Variables ¶
var InvalidNSNameCharacters = regexp.MustCompile("[^a-z0-9-]")
var ( // Root folder of this project Root = filepath.Join(filepath.Dir(b), "..") )
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
Ctx context.Context
Scheme *runtime.Scheme
}
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)
FetchResource fetches resources and puts the items into the given list with the given list options. Test fails on errors.
func (*Suite) IsResourceExisting ¶
IsResourceExisting tries to fetch the given resource and returns true if it exists. It will consider still-existing object with a deletion timestamp as non-existing. Any other errors will fail the test.
func (*Suite) MapToRequest ¶
MapToRequest maps the given object into a reconcile Request.
func (*Suite) RepeatedAssert ¶
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) SetCondition ¶
func (ts *Suite) SetCondition( resource client.Object, conditions *[]metav1.Condition, cType k8upv1a1.ConditionType, status metav1.ConditionStatus, reason k8upv1a1.ConditionReason)
SetCondition sets the given condition and updates the status. Errors will fail the test.
func (*Suite) SetupSuite ¶
func (ts *Suite) SetupSuite()
func (*Suite) SetupTest ¶
func (ts *Suite) SetupTest()
BeforeTest is invoked just before every test starts
func (*Suite) TearDownSuite ¶
func (ts *Suite) TearDownSuite()
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.