File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ // Package testutil provides test utility for Kubernetes operators. The amin
2+ // support is around envtest and resource watching logic, where you can use
3+ // the following code to wait for the matching resource to appear.
4+ //
5+ // Example:
6+ //
7+ // watcher.SetCmpOpts(testutil.CompareSpecOnly()...)
8+ // expectedSts := &appsv1.StatefulSet{
9+ // Spec: appsv1.StatefulSetSpec{Replicas: ptr.To(int32(3))},
10+ // }
11+ // expectedSvc := &corev1.Service{...}
12+ //
13+ // err := watcher.WaitForMatch(expectedSts, expectedSvc)
14+ // if err != nil {
15+ // t.Errorf("Resources never reached expected state: %v", err)
16+ // }
17+ //
18+ // This utility allows resource matching logic to be fully declarative, and
19+ // while integration tests are more expensive to run in terms of time spent,
20+ // this makes sure that there is no unnecessary sleep logic, and all the tests
21+ // can be run in an event driven fashion.
22+ package testutil
You can’t perform that action at this time.
0 commit comments