mirror of
https://github.com/hanzo-ml/kuberay.git
synced 2026-10-30 19:48:47 +00:00
* 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]>
17 lines
567 B
Go
17 lines
567 B
Go
package testing
|
|
|
|
import (
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
rayClientFake "github.com/ray-project/kuberay/ray-operator/pkg/client/clientset/versioned/fake"
|
|
)
|
|
|
|
// NewRayClientset creates a fake Ray clientset with FieldSelector support.
|
|
// This is a convenience wrapper that creates a clientset and adds the
|
|
// FieldSelector reactor, so tests don't need to set it up manually.
|
|
func NewRayClientset(objects ...runtime.Object) *rayClientFake.Clientset {
|
|
client := rayClientFake.NewClientset(objects...)
|
|
AddRayClusterListFieldSelectorReactor(client)
|
|
return client
|
|
}
|