@@ -10,8 +10,6 @@ import (
10
10
)
11
11
12
12
func TestEnsureDeployment (t * testing.T ) {
13
- replicas := int32 (2 )
14
- expectedReplicas := int32 (2 )
15
13
labelSelector := metav1.LabelSelector {}
16
14
tests := []struct {
17
15
name string
@@ -25,29 +23,29 @@ func TestEnsureDeployment(t *testing.T) {
25
23
name : "different replica count" ,
26
24
existing : appsv1.Deployment {
27
25
Spec : appsv1.DeploymentSpec {
28
- Replicas : & replicas }},
26
+ Replicas : int32Pointer ( 2 ) }},
29
27
required : appsv1.Deployment {
30
28
Spec : appsv1.DeploymentSpec {
31
- Replicas : & expectedReplicas }},
29
+ Replicas : int32Pointer ( 3 ) }},
32
30
33
31
expectedModified : true ,
34
32
expected : appsv1.Deployment {
35
33
Spec : appsv1.DeploymentSpec {
36
- Replicas : & expectedReplicas }},
34
+ Replicas : int32Pointer ( 3 ) }},
37
35
},
38
36
{
39
37
name : "same replica count" ,
40
38
existing : appsv1.Deployment {
41
39
Spec : appsv1.DeploymentSpec {
42
- Replicas : & replicas }},
40
+ Replicas : int32Pointer ( 2 ) }},
43
41
required : appsv1.Deployment {
44
42
Spec : appsv1.DeploymentSpec {
45
- Replicas : & replicas }},
43
+ Replicas : int32Pointer ( 2 ) }},
46
44
47
45
expectedModified : false ,
48
46
expected : appsv1.Deployment {
49
47
Spec : appsv1.DeploymentSpec {
50
- Replicas : & replicas }},
48
+ Replicas : int32Pointer ( 2 ) }},
51
49
},
52
50
{
53
51
name : "existing-selector-nil-required-selector-non-nil" ,
@@ -77,3 +75,7 @@ func TestEnsureDeployment(t *testing.T) {
77
75
})
78
76
}
79
77
}
78
+
79
+ func int32Pointer (i int32 ) * int32 {
80
+ return & i
81
+ }
0 commit comments