Skip to content

Commit 3715e20

Browse files
jemishpvincepri
andauthored
add a known limitations section to fake Client (#1031)
* add a known limitations section to `fake.Client` - remove the deprecation warning as per issue #768 - minor typo fixes * fixing comments from PR * reword the limitation around injectable errors * Update pkg/client/fake/doc.go Co-authored-by: Vince Prignano <[email protected]> * Update pkg/client/fake/doc.go Co-authored-by: Vince Prignano <[email protected]> Co-authored-by: Vince Prignano <[email protected]>
1 parent b9af791 commit 3715e20

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pkg/client/fake/doc.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,23 @@ limitations under the License.
1717
/*
1818
Package fake provides a fake client for testing.
1919
20-
Deprecated: please use pkg/envtest for testing. This package will be dropped
21-
before the v1.0.0 release.
22-
23-
An fake client is backed by its simple object store indexed by GroupVersionResource.
20+
A fake client is backed by its simple object store indexed by GroupVersionResource.
2421
You can create a fake client with optional objects.
2522
26-
client := NewFakeClient(initObjs...) // initObjs is a slice of runtime.Object
23+
client := NewFakeClientWithScheme(scheme, initObjs...) // initObjs is a slice of runtime.Object
2724
2825
You can invoke the methods defined in the Client interface.
2926
30-
When it doubt, it's almost always better not to use this package and instead use
27+
When in doubt, it's almost always better not to use this package and instead use
3128
envtest.Environment with a real client and API server.
29+
30+
WARNING: ⚠️ Current Limitations / Known Issues with the fake Client ⚠️
31+
- This client does not have a way to inject specific errors to test handled vs. unhandled errors.
32+
- There is some support for sub resources which can cause issues with tests if you're trying to update
33+
e.g. metadata and status in the same reconcile.
34+
- No OpeanAPI validation is performed when creating or updating objects.
35+
- ObjectMeta's `Generation` and `ResourceVersion` don't behave properly, Patch or Update
36+
operations that rely on these fields will fail, or give false positives.
37+
3238
*/
3339
package fake

0 commit comments

Comments
 (0)