Documentation ¶
Index ¶
- type TestCase
- func (tc *TestCase) GetClient() client.Client
- func (tc *TestCase) Reconcile(r reconcile.Reconciler) (reconcile.Result, error)
- func (tc *TestCase) Runner(t *testing.T, r reconcile.Reconciler, c client.Client) func(t *testing.T)
- func (tc *TestCase) VerifyErr(err error) error
- func (tc *TestCase) VerifyResult(result reconcile.Result) error
- func (tc *TestCase) VerifyWantAbsent(c client.Client) error
- func (tc *TestCase) VerifyWantPresent(c client.Client) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestCase ¶
type TestCase struct { // Name is a descriptive name for this test suitable as a first argument to t.Run() Name string // InitialState is the list of objects that already exists when reconciliation // starts. InitialState []runtime.Object // ReconcileKey is the key of the object to reconcile in namespace/name form. ReconcileKey string // WantErr is true when we expect the Reconcile function to return an error. WantErr bool // WantErrMsg contains the pattern to match the returned error message. // Implies WantErr = true. TODO implement WantErrMsg string // WantResult is the reconcile result we expect to be returned from the // Reconcile function. WantResult reconcile.Result // WantPresent holds the non-exclusive set of objects we expect to exist // after reconciliation completes. WantPresent []runtime.Object // WantAbsent holds the list of objects expected to not exist // after reconciliation completes. WantAbsent []runtime.Object }
TestCase holds a single row of our table test.
func (*TestCase) Reconcile ¶
Reconcile calls the given reconciler's Reconcile() function with the test case's reconcile request.
func (*TestCase) Runner ¶
func (tc *TestCase) Runner(t *testing.T, r reconcile.Reconciler, c client.Client) func(t *testing.T)
Runner returns a testing func that can be passed to t.Run.
func (*TestCase) VerifyErr ¶
VerifyErr verifies that the given error returned from Reconcile is the error expected by the test case.
func (*TestCase) VerifyResult ¶
VerifyResult verifies that the given result returned from Reconcile is the result expected by the test case.
func (*TestCase) VerifyWantAbsent ¶
VerifyWantAbsent verifies that the client does not contain any of the objects expected to be absent after reconciliation.
Click to show internal directories.
Click to hide internal directories.