@@ -63,7 +63,7 @@ func newGPUClusterConfigReconciler(t *testing.T, objs ...client.Object) (*GPUClu
6363// fakeStateManager returns canned SyncState results so the controller tests don't load
6464// real manifests. It records the last info catalog passed to SyncState so tests can
6565// assert on its entries. GetWatchSources is promoted from the embedded (nil) interface
66- // and is never called here — only SetupWithManager calls it, which these tests skip.
66+ // and is never called here; only SetupWithManager calls it, which these tests skip.
6767type fakeStateManager struct {
6868 state.Manager
6969 results state.Results
@@ -117,14 +117,22 @@ func TestGPUClusterConfigReconcileNotFound(t *testing.T) {
117117
118118// A ClusterPolicy in the cluster disables the GPUClusterConfig: the two paths are
119119// mutually exclusive, so the DRA stack is not deployed alongside ClusterPolicy.
120+ // The result requeues so the instance recovers once the ClusterPolicy is removed.
120121func TestGPUClusterConfigDisabledByClusterPolicy (t * testing.T ) {
121122 cfg := & nvidiav1alpha1.GPUClusterConfig {ObjectMeta : metav1.ObjectMeta {Name : "config" }}
122123 cp := & gpuv1.ClusterPolicy {ObjectMeta : metav1.ObjectMeta {Name : "cluster-policy" }}
123124 r , c := newGPUClusterConfigReconciler (t , cfg , cp )
124125
125- gccReconcile (t , r , cfg .Name )
126+ res , err := r .Reconcile (t .Context (), gccRequest (cfg .Name ))
127+ require .NoError (t , err )
128+ require .Positive (t , res .RequeueAfter , "disabled instance must requeue to detect ClusterPolicy removal" )
126129
127130 require .Equal (t , nvidiav1alpha1 .Disabled , gccState (t , c , cfg .Name ))
131+
132+ // Removing the ClusterPolicy lets the next reconcile recover the instance.
133+ require .NoError (t , c .Delete (t .Context (), cp ))
134+ gccReconcile (t , r , cfg .Name )
135+ require .Equal (t , nvidiav1alpha1 .Ready , gccState (t , c , cfg .Name ))
128136}
129137
130138// First-reconciled wins (mirroring ClusterPolicy): whichever instance reconciles first
0 commit comments