@@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"encoding/json"
22
22
"fmt"
23
+ "github.com/karmada-io/karmada/pkg/controllers/binding"
23
24
"time"
24
25
25
26
"github.com/onsi/ginkgo/v2"
@@ -1246,6 +1247,42 @@ var _ = ginkgo.Describe("[Suspension] PropagationPolicy testing", func() {
1246
1247
})
1247
1248
})
1248
1249
1250
+ ginkgo .It ("suspend the PP scheduling" , func () {
1251
+ ginkgo .By ("update the pp suspension scheduling to true" , func () {
1252
+ policy .Spec .Suspension = & policyv1alpha1.Suspension {
1253
+ Scheduling : ptr .To (true ),
1254
+ }
1255
+ framework .UpdatePropagationPolicyWithSpec (karmadaClient , policy .Namespace , policy .Name , policy .Spec )
1256
+ })
1257
+
1258
+ ginkgo .By ("check RB suspension spec" , func () {
1259
+ framework .WaitResourceBindingFitWith (karmadaClient , deployment .Namespace , names .GenerateBindingName (deployment .Kind , deployment .Name ),
1260
+ func (binding * workv1alpha2.ResourceBinding ) bool {
1261
+ return binding .Spec .Suspension != nil && ptr .Deref (binding .Spec .Suspension .Scheduling , false )
1262
+ })
1263
+ })
1264
+
1265
+ ginkgo .By ("check RB Scheduling status condition" , func () {
1266
+ rbName := names .GenerateBindingName (deployment .Kind , deployment .Name )
1267
+ gomega .Eventually (func () bool {
1268
+ rb , err := karmadaClient .WorkV1alpha2 ().ResourceBindings (rbName ).Get (context .TODO (), rbName , metav1.GetOptions {})
1269
+ if err != nil {
1270
+ return false
1271
+ }
1272
+ return rb != nil && meta .IsStatusConditionPresentAndEqual (rb .Status .Conditions , workv1alpha2 .Suspended , metav1 .ConditionTrue )
1273
+ }, pollTimeout , pollInterval ).Should (gomega .Equal (true ))
1274
+ })
1275
+
1276
+ ginkgo .By ("check scheduling event" , func () {
1277
+ rbName := names .GenerateBindingName (deployment .Kind , deployment .Name )
1278
+ framework .WaitEventFitWith (kubeClient , testNamespace , rbName ,
1279
+ func (event corev1.Event ) bool {
1280
+ return event .Reason == events .EventReasonBindingScheduling &&
1281
+ event .Message == binding .SuspendedSchedulingConditionMessage
1282
+ })
1283
+ })
1284
+ })
1285
+
1249
1286
ginkgo .It ("suspension resume" , func () {
1250
1287
ginkgo .By ("update deployment replicas" , func () {
1251
1288
framework .UpdateDeploymentReplicas (kubeClient , deployment , updateDeploymentReplicas )
0 commit comments