client-go/testing
Stephen Kitt c475fe0910 Generify fake clientsets
This adds a generic implementation of a fake clientset, and uses it to
replace the template code in generated fake clientsets for the default
methods. The templates are preserved as-is (or as close as they can
be) for use in extensions, whether for resources or subresources.

Fake clientsets with no extensions are reduced to their main getter,
their specific struct, and their constructor. All method
implementations are provided by the generic implementation. The
dedicated struct is preserved to allow extensions and expansions to be
defined where necessary.

Instead of handling the variants (with/without list, apply) with a
complex sequence of if statements, build up an index into an array
containing the various declarations.

Similarly, instead of calling different action constructors for
namespaced and non-namespaced clientsets, assume the current behaviour
of non-namespaced action creation (equivalent to creating a namespaced
action with an empty namespace) and document that assumption in the
action implementation.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: b0ce65df9b74d4dc72050840d5ad067596d7b822
2024-07-30 15:47:02 +02:00
..
actions.go Generify fake clientsets 2024-07-30 15:47:02 +02:00
fake_test.go remove unneeded references 2022-03-17 18:35:00 +00:00
fake.go Prevent data race condition in csi unit tests 2021-05-18 18:00:03 +08:00
fixture_test.go fix: enable expected-actual rule from testifylint in module k8s.io/client-go 2024-09-27 07:48:55 +02:00
fixture.go Stamp fake client apply reuqests with name from action 2024-08-15 21:24:28 -04:00
interface.go Implement a FakeClient interface 2021-03-15 14:47:24 +01:00