Skip to content

Commit 9ec0705

Browse files
Update suite_test.go client creation details
Update suite_test.go client creation instructions for reading consistency.
1 parent 721b301 commit 9ec0705

File tree

1 file changed

+6
-6
lines changed
  • docs/book/src/cronjob-tutorial/testdata/project/controllers

1 file changed

+6
-6
lines changed

docs/book/src/cronjob-tutorial/testdata/project/controllers/suite_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ var _ = BeforeSuite(func() {
122122
The only difference is that the manager is started in a separate goroutine so it does not block the cleanup of envtest
123123
when you’re done running your tests.
124124
125-
Note that we set up both a "live" k8s client, separate from the manager. This is because when making assertions in
126-
tests, you generally want to assert against the live state of the API server. If you used the client from the
127-
manager (`k8sManager.GetClient`), you'd end up asserting against the contents of the cache instead, which is slower
128-
and can introduce flakiness into your tests. We could use the manager's `APIReader` to accomplish the same thing,
129-
but that would leave us with two clients in our test assertions and setup (one for reading, one for writing), and
130-
it'd be easy to make mistakes.
125+
Note that we set up both a "live" k8s client and a separate client from the manager. This is because when making
126+
assertions in tests, you generally want to assert against the live state of the API server. If you use the client
127+
from the manager (`k8sManager.GetClient`), you'd end up asserting against the contents of the cache instead, which is
128+
slower and can introduce flakiness into your tests. We could use the manager's `APIReader` to accomplish the same
129+
thing, but that would leave us with two clients in our test assertions and setup (one for reading, one for writing),
130+
and it'd be easy to make mistakes.
131131
132132
Note that we keep the reconciler running against the manager's cache client, though -- we want our controller to
133133
behave as it would in production, and we use features of the cache (like indicies) in our controller which aren't

0 commit comments

Comments
 (0)