@@ -88,6 +88,18 @@ func TestOpenTelemetryCollectorReconciler_Reconcile(t *testing.T) {
88
88
}
89
89
deploymentExtraPorts := paramsWithModeAndReplicas (v1alpha1 .ModeDeployment , 3 )
90
90
deploymentExtraPorts .OtelCol .Spec .Ports = append (deploymentExtraPorts .OtelCol .Spec .Ports , extraPorts )
91
+ deploymentExtraPorts .OtelCol .Spec .DeploymentUpdateStrategy = appsv1.DeploymentStrategy {
92
+ RollingUpdate : & appsv1.RollingUpdateDeployment {
93
+ MaxUnavailable : & intstr.IntOrString {
94
+ Type : intstr .Int ,
95
+ IntVal : 1 ,
96
+ },
97
+ MaxSurge : & intstr.IntOrString {
98
+ Type : intstr .Int ,
99
+ IntVal : 1 ,
100
+ },
101
+ },
102
+ }
91
103
ingressParams := newParamsAssertNoErr (t , "" , testFileIngress )
92
104
ingressParams .OtelCol .Spec .Ingress .Type = "ingress"
93
105
updatedIngressParams := newParamsAssertNoErr (t , "" , testFileIngress )
@@ -143,6 +155,9 @@ func TestOpenTelemetryCollectorReconciler_Reconcile(t *testing.T) {
143
155
assert .Equal (t , int32 (2 ), * d .Spec .Replicas )
144
156
assert .Contains (t , d .Annotations , annotationName )
145
157
assert .Contains (t , d .Labels , labelName )
158
+ // confirm the initial strategy is unset
159
+ assert .Equal (t , d .Spec .Strategy .RollingUpdate .MaxUnavailable .IntVal , int32 (0 ))
160
+ assert .Equal (t , d .Spec .Strategy .RollingUpdate .MaxSurge .IntVal , int32 (0 ))
146
161
exists , err = populateObjectIfExists (t , & v1.Service {}, namespacedObjectName (naming .Service (params .OtelCol .Name ), params .OtelCol .Namespace ))
147
162
assert .NoError (t , err )
148
163
assert .True (t , exists )
@@ -163,6 +178,9 @@ func TestOpenTelemetryCollectorReconciler_Reconcile(t *testing.T) {
163
178
assert .NoError (t , err )
164
179
assert .True (t , exists )
165
180
assert .Equal (t , int32 (3 ), * d .Spec .Replicas )
181
+ // confirm the strategy has been changed
182
+ assert .Equal (t , d .Spec .Strategy .RollingUpdate .MaxUnavailable .IntVal , int32 (1 ))
183
+ assert .Equal (t , d .Spec .Strategy .RollingUpdate .MaxSurge .IntVal , int32 (1 ))
166
184
// confirm that we don't remove annotations and labels even if we don't set them
167
185
assert .Contains (t , d .Annotations , annotationName )
168
186
assert .Contains (t , d .Labels , labelName )
0 commit comments