Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultEventuallyTimeout is the default timeout for EventuallyConfig. DefaultEventuallyTimeout = 1 * time.Second // DefaultEventuallyPeriod is the default period for EventuallyConfig. DefaultEventuallyPeriod = 10 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventuallyConfig ¶ added in v1.0.7
type EventuallyConfig struct {
// Timeout is the maximum time to wait for the condition to be true.
Timeout time.Duration
// Period is the time to wait between retries.
Period time.Duration
}
EventuallyConfig is the configuration for assert.Eventually() which is used to assert errors.
type TestCase ¶
type TestCase[T client.Object] struct { // Name is the name of the test case. Name string // TestObject is the object to be tested. TestObject T // ExpectedErrorMessage is the expected error message when creating the object. ExpectedErrorMessage *string // ExpectedErrorEventuallyConfig is the configuration for assert.Eventually() which is used to assert the create error. // If not provided the error is checked immediately, just once. ExpectedErrorEventuallyConfig EventuallyConfig // ExpectedUpdateErrorMessage is the expected error message when updating the object. ExpectedUpdateErrorMessage *string // Update is a function that updates the object in the test case after it's created. // It can be used to verify CEL rules that verify the previous object's version against the new one. Update func(T) }
TestCase represents a test case for CRD validation.
type TestCasesGroup ¶
TestCasesGroup is a group of test cases related to CRD validation.
func (TestCasesGroup[T]) Run ¶
func (g TestCasesGroup[T]) Run(t *testing.T)
Run runs all test cases in the group.
func (TestCasesGroup[T]) RunWithConfig ¶
RunWithConfig runs all test cases in the group against the provided rest.Config's cluster.
Click to show internal directories.
Click to hide internal directories.