@@ -60,10 +60,10 @@ var _ = SIGDescribe("DNS horizontal autoscaling", func() {
60
60
By ("Collecting original replicas count and DNS scaling params" )
61
61
var err error
62
62
originDNSReplicasCount , err = getDNSReplicas (c )
63
- Expect ( err ). NotTo ( HaveOccurred () )
63
+ framework . ExpectNoError ( err )
64
64
65
65
pcm , err := fetchDNSScalingConfigMap (c )
66
- Expect ( err ). NotTo ( HaveOccurred () )
66
+ framework . ExpectNoError ( err )
67
67
previousParams = pcm .Data
68
68
69
69
if nodeCount <= 500 {
@@ -100,28 +100,30 @@ var _ = SIGDescribe("DNS horizontal autoscaling", func() {
100
100
// Will take around 5 minutes to run on a 4 nodes cluster.
101
101
It ("[Serial] [Slow] kube-dns-autoscaler should scale kube-dns pods when cluster size changed" , func () {
102
102
numNodes , err := framework .NumberOfRegisteredNodes (c )
103
- Expect ( err ). NotTo ( HaveOccurred () )
103
+ framework . ExpectNoError ( err )
104
104
105
105
By ("Replace the dns autoscaling parameters with testing parameters" )
106
106
err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_1 )))
107
- Expect ( err ). NotTo ( HaveOccurred () )
107
+ framework . ExpectNoError ( err )
108
108
defer func () {
109
109
By ("Restoring initial dns autoscaling parameters" )
110
- Expect (updateDNSScalingConfigMap (c , packDNSScalingConfigMap (previousParams ))).NotTo (HaveOccurred ())
110
+ err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (previousParams ))
111
+ framework .ExpectNoError (err )
111
112
112
113
By ("Wait for number of running and ready kube-dns pods recover" )
113
114
label := labels .SelectorFromSet (labels .Set (map [string ]string {ClusterAddonLabelKey : DNSLabelName }))
114
115
_ , err := framework .WaitForPodsWithLabelRunningReady (c , metav1 .NamespaceSystem , label , originDNSReplicasCount , DNSdefaultTimeout )
115
- Expect ( err ). NotTo ( HaveOccurred () )
116
+ framework . ExpectNoError ( err )
116
117
}()
117
118
By ("Wait for kube-dns scaled to expected number" )
118
119
getExpectReplicasLinear := getExpectReplicasFuncLinear (c , & DNSParams_1 )
119
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
120
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
121
+ framework .ExpectNoError (err )
120
122
121
123
originalSizes := make (map [string ]int )
122
124
for _ , mig := range strings .Split (framework .TestContext .CloudConfig .NodeInstanceGroup , "," ) {
123
125
size , err := framework .GroupSize (mig )
124
- Expect ( err ). NotTo ( HaveOccurred () )
126
+ framework . ExpectNoError ( err )
125
127
By (fmt .Sprintf ("Initial size of %s: %d" , mig , size ))
126
128
originalSizes [mig ] = size
127
129
}
@@ -132,77 +134,88 @@ var _ = SIGDescribe("DNS horizontal autoscaling", func() {
132
134
increasedSizes [key ] = val + 1
133
135
}
134
136
setMigSizes (increasedSizes )
135
- Expect (WaitForClusterSizeFunc (c ,
136
- func (size int ) bool { return size == numNodes + len (originalSizes ) }, scaleUpTimeout )).NotTo (HaveOccurred ())
137
+ err = WaitForClusterSizeFunc (c ,
138
+ func (size int ) bool { return size == numNodes + len (originalSizes ) }, scaleUpTimeout )
139
+ framework .ExpectNoError (err )
137
140
138
141
By ("Wait for kube-dns scaled to expected number" )
139
142
getExpectReplicasLinear = getExpectReplicasFuncLinear (c , & DNSParams_1 )
140
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
143
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
144
+ framework .ExpectNoError (err )
141
145
142
146
By ("Replace the dns autoscaling parameters with another testing parameters" )
143
147
err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_3 )))
144
- Expect ( err ). NotTo ( HaveOccurred () )
148
+ framework . ExpectNoError ( err )
145
149
146
150
By ("Wait for kube-dns scaled to expected number" )
147
151
getExpectReplicasLinear = getExpectReplicasFuncLinear (c , & DNSParams_3 )
148
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
152
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
153
+ framework .ExpectNoError (err )
149
154
150
155
By ("Restoring cluster size" )
151
156
setMigSizes (originalSizes )
152
- Expect (framework .WaitForReadyNodes (c , numNodes , scaleDownTimeout )).NotTo (HaveOccurred ())
157
+ err = framework .WaitForReadyNodes (c , numNodes , scaleDownTimeout )
158
+ framework .ExpectNoError (err )
153
159
154
160
By ("Wait for kube-dns scaled to expected number" )
155
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
161
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
162
+ framework .ExpectNoError (err )
156
163
})
157
164
158
165
// TODO: Get rid of [DisabledForLargeClusters] tag when issue #55779 is fixed.
159
166
It ("[DisabledForLargeClusters] kube-dns-autoscaler should scale kube-dns pods in both nonfaulty and faulty scenarios" , func () {
160
167
161
168
By ("Replace the dns autoscaling parameters with testing parameters" )
162
169
err := updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_1 )))
163
- Expect ( err ). NotTo ( HaveOccurred () )
170
+ framework . ExpectNoError ( err )
164
171
defer func () {
165
172
By ("Restoring initial dns autoscaling parameters" )
166
- Expect (updateDNSScalingConfigMap (c , packDNSScalingConfigMap (previousParams ))).NotTo (HaveOccurred ())
173
+ err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (previousParams ))
174
+ framework .ExpectNoError (err )
167
175
}()
168
176
By ("Wait for kube-dns scaled to expected number" )
169
177
getExpectReplicasLinear := getExpectReplicasFuncLinear (c , & DNSParams_1 )
170
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
178
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
179
+ framework .ExpectNoError (err )
171
180
172
181
By ("--- Scenario: should scale kube-dns based on changed parameters ---" )
173
182
By ("Replace the dns autoscaling parameters with another testing parameters" )
174
183
err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_3 )))
175
- Expect ( err ). NotTo ( HaveOccurred () )
184
+ framework . ExpectNoError ( err )
176
185
By ("Wait for kube-dns scaled to expected number" )
177
186
getExpectReplicasLinear = getExpectReplicasFuncLinear (c , & DNSParams_3 )
178
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
187
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
188
+ framework .ExpectNoError (err )
179
189
180
190
By ("--- Scenario: should re-create scaling parameters with default value when parameters got deleted ---" )
181
191
By ("Delete the ConfigMap for autoscaler" )
182
192
err = deleteDNSScalingConfigMap (c )
183
- Expect ( err ). NotTo ( HaveOccurred () )
193
+ framework . ExpectNoError ( err )
184
194
185
195
By ("Wait for the ConfigMap got re-created" )
186
196
_ , err = waitForDNSConfigMapCreated (c , DNSdefaultTimeout )
187
- Expect ( err ). NotTo ( HaveOccurred () )
197
+ framework . ExpectNoError ( err )
188
198
189
199
By ("Replace the dns autoscaling parameters with another testing parameters" )
190
200
err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_2 )))
191
- Expect ( err ). NotTo ( HaveOccurred () )
201
+ framework . ExpectNoError ( err )
192
202
By ("Wait for kube-dns scaled to expected number" )
193
203
getExpectReplicasLinear = getExpectReplicasFuncLinear (c , & DNSParams_2 )
194
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
204
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
205
+ framework .ExpectNoError (err )
195
206
196
207
By ("--- Scenario: should recover after autoscaler pod got deleted ---" )
197
208
By ("Delete the autoscaler pod for kube-dns" )
198
- Expect (deleteDNSAutoscalerPod (c )).NotTo (HaveOccurred ())
209
+ err = deleteDNSAutoscalerPod (c )
210
+ framework .ExpectNoError (err )
199
211
200
212
By ("Replace the dns autoscaling parameters with another testing parameters" )
201
213
err = updateDNSScalingConfigMap (c , packDNSScalingConfigMap (packLinearParams (& DNSParams_1 )))
202
- Expect ( err ). NotTo ( HaveOccurred () )
214
+ framework . ExpectNoError ( err )
203
215
By ("Wait for kube-dns scaled to expected number" )
204
216
getExpectReplicasLinear = getExpectReplicasFuncLinear (c , & DNSParams_1 )
205
- Expect (waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )).NotTo (HaveOccurred ())
217
+ err = waitForDNSReplicasSatisfied (c , getExpectReplicasLinear , DNSdefaultTimeout )
218
+ framework .ExpectNoError (err )
206
219
})
207
220
})
208
221
0 commit comments