@@ -24,6 +24,7 @@ import (
24
24
"github.com/onsi/ginkgo/v2"
25
25
"github.com/onsi/gomega"
26
26
appsv1 "k8s.io/api/apps/v1"
27
+ corev1 "k8s.io/api/core/v1"
27
28
rbacv1 "k8s.io/api/rbac/v1"
28
29
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
29
30
"k8s.io/apimachinery/pkg/api/meta"
@@ -37,6 +38,8 @@ import (
37
38
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
38
39
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
39
40
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
41
+ "github.com/karmada-io/karmada/pkg/controllers/binding"
42
+ "github.com/karmada-io/karmada/pkg/events"
40
43
"github.com/karmada-io/karmada/pkg/util/helper"
41
44
"github.com/karmada-io/karmada/pkg/util/names"
42
45
"github.com/karmada-io/karmada/test/e2e/framework"
@@ -1150,4 +1153,37 @@ var _ = ginkgo.Describe("[Suspension] ClusterPropagationPolicy testing", func()
1150
1153
}, pollTimeout , pollInterval ).Should (gomega .Equal (true ))
1151
1154
})
1152
1155
})
1156
+
1157
+ ginkgo .It ("suspend the CPP scheduling" , func () {
1158
+ ginkgo .By ("update the cpp suspension scheduling to true" , func () {
1159
+ policy .Spec .Suspension = & policyv1alpha1.Suspension {
1160
+ Scheduling : ptr .To (true ),
1161
+ }
1162
+ framework .UpdateClusterPropagationPolicyWithSpec (karmadaClient , policy .Name , policy .Spec )
1163
+ })
1164
+
1165
+ ginkgo .By ("check CRB suspension spec" , func () {
1166
+ framework .WaitClusterResourceBindingFitWith (karmadaClient , resourceBindingName , func (binding * workv1alpha2.ClusterResourceBinding ) bool {
1167
+ return binding .Spec .Suspension != nil && ptr .Deref (binding .Spec .Suspension .Scheduling , false )
1168
+ })
1169
+ })
1170
+
1171
+ ginkgo .By ("check Work Scheduling status condition" , func () {
1172
+ gomega .Eventually (func () bool {
1173
+ crb , err := karmadaClient .WorkV1alpha2 ().ClusterResourceBindings ().Get (context .TODO (), resourceBindingName , metav1.GetOptions {})
1174
+ if err != nil {
1175
+ return false
1176
+ }
1177
+ return crb != nil && meta .IsStatusConditionPresentAndEqual (crb .Status .Conditions , workv1alpha2 .Suspended , metav1 .ConditionTrue )
1178
+ }, pollTimeout , pollInterval ).Should (gomega .Equal (true ))
1179
+ })
1180
+
1181
+ ginkgo .By ("check scheduling event" , func () {
1182
+ framework .WaitEventFitWith (kubeClient , "" , resourceBindingName ,
1183
+ func (event corev1.Event ) bool {
1184
+ return event .Reason == events .EventReasonBindingScheduling &&
1185
+ event .Message == binding .SuspendedSchedulingConditionMessage
1186
+ })
1187
+ })
1188
+ })
1153
1189
})
0 commit comments