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