@@ -16,6 +16,7 @@ import (
16
16
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
17
17
"k8s.io/apimachinery/pkg/runtime"
18
18
"k8s.io/apimachinery/pkg/types"
19
+ "k8s.io/utils/pointer"
19
20
"sigs.k8s.io/controller-runtime/pkg/reconcile"
20
21
21
22
stubs "github.com/oracle/coherence-operator/pkg/fakes"
@@ -78,7 +79,7 @@ var _ = Describe("coherencecluster_controller", func() {
78
79
mgr .AssertCoherenceRoles (testNamespace , 1 )
79
80
name := cluster .Spec .CoherenceRoleSpec .GetFullRoleName (cluster )
80
81
role := mgr .AssertCoherenceRoleExists (testNamespace , name )
81
- Expect (role .Spec ).To (Equal (coherence.CoherenceRoleSpec {}))
82
+ Expect (role .Spec ).To (Equal (coherence.CoherenceRoleSpec {Replicas : pointer . Int32Ptr ( coherence . DefaultReplicas ) }))
82
83
})
83
84
84
85
It ("should fire a successful CoherenceRole create event" , func () {
@@ -149,7 +150,9 @@ var _ = Describe("coherencecluster_controller", func() {
149
150
mgr .AssertCoherenceRoles (testNamespace , 1 )
150
151
name := roleSpec .GetFullRoleName (cluster )
151
152
role := mgr .AssertCoherenceRoleExists (testNamespace , name )
152
- Expect (role .Spec ).To (Equal (roleSpec ))
153
+ expected := roleSpec .DeepCopy ()
154
+ expected .SetReplicas (coherence .DefaultReplicas )
155
+ Expect (role .Spec ).To (Equal (* expected ))
153
156
})
154
157
})
155
158
})
@@ -220,13 +223,17 @@ var _ = Describe("coherencecluster_controller", func() {
220
223
It ("should create a CoherenceRole for the first role" , func () {
221
224
name := roleSpecOne .GetFullRoleName (cluster )
222
225
role := mgr .AssertCoherenceRoleExists (testNamespace , name )
223
- Expect (role .Spec ).To (Equal (roleSpecOne ))
226
+ expected := roleSpecOne .DeepCopy ()
227
+ expected .SetReplicas (coherence .DefaultReplicas )
228
+ Expect (role .Spec ).To (Equal (* expected ))
224
229
})
225
230
226
231
It ("should create a CoherenceRole for the second role" , func () {
227
232
name := roleSpecTwo .GetFullRoleName (cluster )
228
233
role := mgr .AssertCoherenceRoleExists (testNamespace , name )
229
- Expect (role .Spec ).To (Equal (roleSpecTwo ))
234
+ expected := roleSpecTwo .DeepCopy ()
235
+ expected .SetReplicas (coherence .DefaultReplicas )
236
+ Expect (role .Spec ).To (Equal (* expected ))
230
237
})
231
238
})
232
239
})
@@ -320,7 +327,9 @@ var _ = Describe("coherencecluster_controller", func() {
320
327
mgr .AssertCoherenceRoles (testNamespace , 1 )
321
328
name := existingRoleSpec .GetFullRoleName (cluster )
322
329
role := mgr .AssertCoherenceRoleExists (testNamespace , name )
323
- Expect (role .Spec ).To (Equal (updatedRoleSpec ))
330
+ expected := updatedRoleSpec .DeepCopy ()
331
+ expected .SetReplicas (coherence .DefaultReplicas )
332
+ Expect (role .Spec ).To (Equal (* expected ))
324
333
})
325
334
326
335
It ("should fire a successful CoherenceRole update event" , func () {
@@ -426,7 +435,8 @@ var _ = Describe("coherencecluster_controller", func() {
426
435
Labels : map [string ]string {coherence .CoherenceClusterLabel : testClusterName },
427
436
},
428
437
Spec : coherence.CoherenceRoleSpec {
429
- Role : "storage" ,
438
+ Role : "storage" ,
439
+ Replicas : pointer .Int32Ptr (2 ),
430
440
},
431
441
}
432
442
@@ -437,7 +447,8 @@ var _ = Describe("coherencecluster_controller", func() {
437
447
Labels : map [string ]string {coherence .CoherenceClusterLabel : testClusterName },
438
448
},
439
449
Spec : coherence.CoherenceRoleSpec {
440
- Role : "proxy" ,
450
+ Role : "proxy" ,
451
+ Replicas : pointer .Int32Ptr (2 ),
441
452
},
442
453
}
443
454
0 commit comments