@@ -232,7 +232,10 @@ func TestEnsureIdling(t *testing.T) {
232232 AAPRunning (noise .aap ).
233233 InferenceServiceDoesNotExist (podsRunningForTooLong .inferenceService ).
234234 InferenceServiceExists (podsTooEarlyToKill .inferenceService ).
235- InferenceServiceExists (noise .inferenceService )
235+ InferenceServiceExists (noise .inferenceService ).
236+ ClawIdled (podsRunningForTooLong .claw ).
237+ ClawRunning (podsTooEarlyToKill .claw ).
238+ ClawRunning (noise .claw )
236239
237240 memberoperatortest .AssertThatIdler (t , idler .Name , fakeClients ).
238241 HasConditions (memberoperatortest .Running (), memberoperatortest .IdlerNotificationCreated ())
@@ -333,7 +336,8 @@ func TestEnsureIdling(t *testing.T) {
333336 StatefulSetScaledDown (toKill .statefulSet ).
334337 VMStopped (toKill .vmStopCallCounter ).
335338 AAPIdled (toKill .aap ).
336- InferenceServiceDoesNotExist (toKill .inferenceService )
339+ InferenceServiceDoesNotExist (toKill .inferenceService ).
340+ ClawIdled (toKill .claw )
337341
338342 memberoperatortest .AssertThatIdler (t , idler .Name , fakeClients ).
339343 ContainsCondition (memberoperatortest .FailedToIdle (strings .Split (err .Error (), ": " )[1 ]))
@@ -550,7 +554,8 @@ func TestEnsureIdlingFailed(t *testing.T) {
550554 StatefulSetScaledDown (toKill .statefulSet ).
551555 VMStopped (toKill .vmStopCallCounter ).
552556 AAPIdled (toKill .aap ).
553- InferenceServiceDoesNotExist (toKill .inferenceService )
557+ InferenceServiceDoesNotExist (toKill .inferenceService ).
558+ ClawIdled (toKill .claw )
554559 })
555560}
556561
@@ -884,6 +889,7 @@ type payloads struct {
884889 aap * unstructured.Unstructured
885890 servingRuntime * unstructured.Unstructured
886891 inferenceService * unstructured.Unstructured
892+ claw * unstructured.Unstructured
887893}
888894
889895func (p payloads ) getFirstControlledPod (ownerName string ) * corev1.Pod {
@@ -1089,6 +1095,13 @@ func preparePayloads(t *testing.T, clients *memberoperatortest.FakeClientSet, na
10891095 inferenceService .SetCreationTimestamp (* sTime )
10901096 createObjectWithDynamicClient (t , clients .DynamicClient , inferenceService )
10911097
1098+ // Claw
1099+ clawObject := newClaw (fmt .Sprintf ("%s%s-claw" , namePrefix , namespace ), namespace )
1100+ createObjectWithDynamicClient (t , clients .DynamicClient , clawObject )
1101+ _ , clawRs := createDeployment (t , clients , namespace , namePrefix , "-claw-deployment" , clawObject )
1102+ replicaSetsWithDeployment = append (replicaSetsWithDeployment , clawRs )
1103+ controlledPods = createPods (t , clients .AllNamespacesClient , clawRs , sTime , controlledPods , noRestart ())
1104+
10921105 // Pods with unknown owner. They are subject of direct management by the Idler.
10931106 // It doesn't have to be Idler. We just need any object as the owner of the pods
10941107 // which is not a supported owner such as Deployment or ReplicaSet.
@@ -1144,6 +1157,7 @@ func preparePayloads(t *testing.T, clients *memberoperatortest.FakeClientSet, na
11441157 aap : aapObject ,
11451158 servingRuntime : servingRuntimeObject ,
11461159 inferenceService : inferenceService ,
1160+ claw : clawObject ,
11471161 }
11481162}
11491163
@@ -1154,6 +1168,16 @@ func newAAP(t *testing.T, idled bool, name, namespace string) *unstructured.Unst
11541168 return aap
11551169}
11561170
1171+ func newClaw (name , namespace string ) * unstructured.Unstructured {
1172+ claw := & unstructured.Unstructured {}
1173+ claw .SetAPIVersion ("claw.sandbox.redhat.com/v1alpha1" )
1174+ claw .SetKind ("Claw" )
1175+ claw .SetName (name )
1176+ claw .SetNamespace (namespace )
1177+ unstructured .SetNestedField (claw .Object , false , "spec" , "idle" ) //nolint:errcheck
1178+ return claw
1179+ }
1180+
11571181func newServingRuntime (name , namespace string ) * unstructured.Unstructured {
11581182 servingRuntime := & unstructured.Unstructured {}
11591183 servingRuntime .SetAPIVersion ("serving.kserve.io/v1alpha1" )
0 commit comments