Files
81c526d7d0 [kubectl-plugin][Test] Use client-go reactors for FieldSelector filtering in fake client tests (#4361)
* feat(kubectl-plugin): add FieldSelector reactor helper for fake client tests

Add AddRayClusterFieldSelectorReactor helper that simulates server-side
FieldSelector filtering in fake client tests. This addresses issue #4337
by allowing tests to verify filtering behavior without manual name checks.

Refs: #4337

* test(kubectl-plugin): apply FieldSelector reactor to completion tests

Use the new AddRayClusterFieldSelectorReactor in workergroup completion
tests to properly simulate server-side filtering behavior.

Refs: #4337

* refactor(kubectl-plugin): remove manual name filtering in completion

Remove the workaround that manually filtered clusters by name since the
fake client now properly supports FieldSelector filtering via reactors.

Refs: #4337

* chore(kubectl-plugin): migrate from NewSimpleClientset to NewClientset

NewSimpleClientset is deprecated in favor of NewClientset for better
server-side apply testing support.

Note: scale_cluster_test.go is not migrated because it uses Update
operations that require schema definitions missing from the generated
applyconfiguration internal schema.

Refs: #4337

* refactor(kubectl-plugin): add NewRayClientset wrapper for simpler test setup

Add a convenience wrapper that creates a fake Ray clientset with
FieldSelector reactor pre-configured. This simplifies test setup
and ensures consistent behavior across tests.

Also applies reactor to get_cluster_test.go and fixes test data
to match actual cluster names now that FieldSelector properly filters.

Refs: #4337

* Update kubectl-plugin/pkg/util/client/testing/reactor.go

Co-authored-by: JustinYeh <[email protected]>
Signed-off-by: Ikenna <[email protected]>

* fix(kubectl-plugin): update references to renamed reactor function

Update clientset.go and reactor_test.go to use the renamed function
AddRayClusterListFieldSelectorReactor.

---------

Signed-off-by: Ikenna <[email protected]>
Co-authored-by: JustinYeh <[email protected]>
2026-01-12 22:18:46 +08:00
..