@@ -32,7 +32,6 @@ import (
32
32
clientset "k8s.io/client-go/kubernetes"
33
33
api "k8s.io/kubernetes/pkg/apis/core"
34
34
"k8s.io/kubernetes/test/e2e/framework"
35
- e2elog "k8s.io/kubernetes/test/e2e/framework/log"
36
35
"k8s.io/kubernetes/test/e2e/framework/replicaset"
37
36
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
38
37
testutils "k8s.io/kubernetes/test/utils"
@@ -171,19 +170,19 @@ func newResourceConsumer(name, nsName string, kind schema.GroupVersionKind, repl
171
170
172
171
// ConsumeCPU consumes given number of CPU
173
172
func (rc * ResourceConsumer ) ConsumeCPU (millicores int ) {
174
- e2elog .Logf ("RC %s: consume %v millicores in total" , rc .name , millicores )
173
+ framework .Logf ("RC %s: consume %v millicores in total" , rc .name , millicores )
175
174
rc .cpu <- millicores
176
175
}
177
176
178
177
// ConsumeMem consumes given number of Mem
179
178
func (rc * ResourceConsumer ) ConsumeMem (megabytes int ) {
180
- e2elog .Logf ("RC %s: consume %v MB in total" , rc .name , megabytes )
179
+ framework .Logf ("RC %s: consume %v MB in total" , rc .name , megabytes )
181
180
rc .mem <- megabytes
182
181
}
183
182
184
183
// ConsumeMem consumes given number of custom metric
185
184
func (rc * ResourceConsumer ) ConsumeCustomMetric (amount int ) {
186
- e2elog .Logf ("RC %s: consume custom metric %v in total" , rc .name , amount )
185
+ framework .Logf ("RC %s: consume custom metric %v in total" , rc .name , amount )
187
186
rc .customMetric <- amount
188
187
}
189
188
@@ -196,13 +195,13 @@ func (rc *ResourceConsumer) makeConsumeCPURequests() {
196
195
for {
197
196
select {
198
197
case millicores = <- rc .cpu :
199
- e2elog .Logf ("RC %s: setting consumption to %v millicores in total" , rc .name , millicores )
198
+ framework .Logf ("RC %s: setting consumption to %v millicores in total" , rc .name , millicores )
200
199
case <- time .After (sleepTime ):
201
- e2elog .Logf ("RC %s: sending request to consume %d millicores" , rc .name , millicores )
200
+ framework .Logf ("RC %s: sending request to consume %d millicores" , rc .name , millicores )
202
201
rc .sendConsumeCPURequest (millicores )
203
202
sleepTime = rc .sleepTime
204
203
case <- rc .stopCPU :
205
- e2elog .Logf ("RC %s: stopping CPU consumer" , rc .name )
204
+ framework .Logf ("RC %s: stopping CPU consumer" , rc .name )
206
205
return
207
206
}
208
207
}
@@ -217,13 +216,13 @@ func (rc *ResourceConsumer) makeConsumeMemRequests() {
217
216
for {
218
217
select {
219
218
case megabytes = <- rc .mem :
220
- e2elog .Logf ("RC %s: setting consumption to %v MB in total" , rc .name , megabytes )
219
+ framework .Logf ("RC %s: setting consumption to %v MB in total" , rc .name , megabytes )
221
220
case <- time .After (sleepTime ):
222
- e2elog .Logf ("RC %s: sending request to consume %d MB" , rc .name , megabytes )
221
+ framework .Logf ("RC %s: sending request to consume %d MB" , rc .name , megabytes )
223
222
rc .sendConsumeMemRequest (megabytes )
224
223
sleepTime = rc .sleepTime
225
224
case <- rc .stopMem :
226
- e2elog .Logf ("RC %s: stopping mem consumer" , rc .name )
225
+ framework .Logf ("RC %s: stopping mem consumer" , rc .name )
227
226
return
228
227
}
229
228
}
@@ -238,13 +237,13 @@ func (rc *ResourceConsumer) makeConsumeCustomMetric() {
238
237
for {
239
238
select {
240
239
case delta = <- rc .customMetric :
241
- e2elog .Logf ("RC %s: setting bump of metric %s to %d in total" , rc .name , customMetricName , delta )
240
+ framework .Logf ("RC %s: setting bump of metric %s to %d in total" , rc .name , customMetricName , delta )
242
241
case <- time .After (sleepTime ):
243
- e2elog .Logf ("RC %s: sending request to consume %d of custom metric %s" , rc .name , delta , customMetricName )
242
+ framework .Logf ("RC %s: sending request to consume %d of custom metric %s" , rc .name , delta , customMetricName )
244
243
rc .sendConsumeCustomMetric (delta )
245
244
sleepTime = rc .sleepTime
246
245
case <- rc .stopCustomMetric :
247
- e2elog .Logf ("RC %s: stopping metric consumer" , rc .name )
246
+ framework .Logf ("RC %s: stopping metric consumer" , rc .name )
248
247
return
249
248
}
250
249
}
@@ -264,10 +263,10 @@ func (rc *ResourceConsumer) sendConsumeCPURequest(millicores int) {
264
263
Param ("millicores" , strconv .Itoa (millicores )).
265
264
Param ("durationSec" , strconv .Itoa (rc .consumptionTimeInSeconds )).
266
265
Param ("requestSizeMillicores" , strconv .Itoa (rc .requestSizeInMillicores ))
267
- e2elog .Logf ("ConsumeCPU URL: %v" , * req .URL ())
266
+ framework .Logf ("ConsumeCPU URL: %v" , * req .URL ())
268
267
_ , err = req .DoRaw ()
269
268
if err != nil {
270
- e2elog .Logf ("ConsumeCPU failure: %v" , err )
269
+ framework .Logf ("ConsumeCPU failure: %v" , err )
271
270
return false , nil
272
271
}
273
272
return true , nil
@@ -291,10 +290,10 @@ func (rc *ResourceConsumer) sendConsumeMemRequest(megabytes int) {
291
290
Param ("megabytes" , strconv .Itoa (megabytes )).
292
291
Param ("durationSec" , strconv .Itoa (rc .consumptionTimeInSeconds )).
293
292
Param ("requestSizeMegabytes" , strconv .Itoa (rc .requestSizeInMegabytes ))
294
- e2elog .Logf ("ConsumeMem URL: %v" , * req .URL ())
293
+ framework .Logf ("ConsumeMem URL: %v" , * req .URL ())
295
294
_ , err = req .DoRaw ()
296
295
if err != nil {
297
- e2elog .Logf ("ConsumeMem failure: %v" , err )
296
+ framework .Logf ("ConsumeMem failure: %v" , err )
298
297
return false , nil
299
298
}
300
299
return true , nil
@@ -319,10 +318,10 @@ func (rc *ResourceConsumer) sendConsumeCustomMetric(delta int) {
319
318
Param ("delta" , strconv .Itoa (delta )).
320
319
Param ("durationSec" , strconv .Itoa (rc .consumptionTimeInSeconds )).
321
320
Param ("requestSizeMetrics" , strconv .Itoa (rc .requestSizeCustomMetric ))
322
- e2elog .Logf ("ConsumeCustomMetric URL: %v" , * req .URL ())
321
+ framework .Logf ("ConsumeCustomMetric URL: %v" , * req .URL ())
323
322
_ , err = req .DoRaw ()
324
323
if err != nil {
325
- e2elog .Logf ("ConsumeCustomMetric failure: %v" , err )
324
+ framework .Logf ("ConsumeCustomMetric failure: %v" , err )
326
325
return false , nil
327
326
}
328
327
return true , nil
@@ -336,25 +335,25 @@ func (rc *ResourceConsumer) GetReplicas() int {
336
335
replicationController , err := rc .clientSet .CoreV1 ().ReplicationControllers (rc .nsName ).Get (rc .name , metav1.GetOptions {})
337
336
framework .ExpectNoError (err )
338
337
if replicationController == nil {
339
- e2elog .Failf (rcIsNil )
338
+ framework .Failf (rcIsNil )
340
339
}
341
340
return int (replicationController .Status .ReadyReplicas )
342
341
case KindDeployment :
343
342
deployment , err := rc .clientSet .AppsV1 ().Deployments (rc .nsName ).Get (rc .name , metav1.GetOptions {})
344
343
framework .ExpectNoError (err )
345
344
if deployment == nil {
346
- e2elog .Failf (deploymentIsNil )
345
+ framework .Failf (deploymentIsNil )
347
346
}
348
347
return int (deployment .Status .ReadyReplicas )
349
348
case KindReplicaSet :
350
349
rs , err := rc .clientSet .AppsV1 ().ReplicaSets (rc .nsName ).Get (rc .name , metav1.GetOptions {})
351
350
framework .ExpectNoError (err )
352
351
if rs == nil {
353
- e2elog .Failf (rsIsNil )
352
+ framework .Failf (rsIsNil )
354
353
}
355
354
return int (rs .Status .ReadyReplicas )
356
355
default :
357
- e2elog .Failf (invalidKind )
356
+ framework .Failf (invalidKind )
358
357
}
359
358
return 0
360
359
}
@@ -367,7 +366,7 @@ func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int, duration time.D
367
366
interval := 20 * time .Second
368
367
err := wait .PollImmediate (interval , duration , func () (bool , error ) {
369
368
replicas := rc .GetReplicas ()
370
- e2elog .Logf ("waiting for %d replicas (current: %d)" , desiredReplicas , replicas )
369
+ framework .Logf ("waiting for %d replicas (current: %d)" , desiredReplicas , replicas )
371
370
return replicas == desiredReplicas , nil // Expected number of replicas found. Exit.
372
371
})
373
372
framework .ExpectNoErrorWithOffset (1 , err , "timeout waiting %v for %d replicas" , duration , desiredReplicas )
@@ -381,12 +380,12 @@ func (rc *ResourceConsumer) EnsureDesiredReplicasInRange(minDesiredReplicas, max
381
380
interval := 10 * time .Second
382
381
err := wait .PollImmediate (interval , duration , func () (bool , error ) {
383
382
replicas := rc .GetReplicas ()
384
- e2elog .Logf ("expecting there to be in [%d, %d] replicas (are: %d)" , minDesiredReplicas , maxDesiredReplicas , replicas )
383
+ framework .Logf ("expecting there to be in [%d, %d] replicas (are: %d)" , minDesiredReplicas , maxDesiredReplicas , replicas )
385
384
as , err := rc .GetHpa (hpaName )
386
385
if err != nil {
387
- e2elog .Logf ("Error getting HPA: %s" , err )
386
+ framework .Logf ("Error getting HPA: %s" , err )
388
387
} else {
389
- e2elog .Logf ("HPA status: %+v" , as .Status )
388
+ framework .Logf ("HPA status: %+v" , as .Status )
390
389
}
391
390
if replicas < minDesiredReplicas {
392
391
return false , fmt .Errorf ("number of replicas below target" )
@@ -398,7 +397,7 @@ func (rc *ResourceConsumer) EnsureDesiredReplicasInRange(minDesiredReplicas, max
398
397
})
399
398
// The call above always returns an error, but if it is timeout, it's OK (condition satisfied all the time).
400
399
if err == wait .ErrWaitTimeout {
401
- e2elog .Logf ("Number of replicas was stable over %v" , duration )
400
+ framework .Logf ("Number of replicas was stable over %v" , duration )
402
401
return
403
402
}
404
403
framework .ExpectNoErrorWithOffset (1 , err )
@@ -491,7 +490,7 @@ func runServiceAndWorkloadForResourceConsumer(c clientset.Interface, ns, name st
491
490
framework .ExpectNoError (replicaset .RunReplicaSet (rsConfig ))
492
491
break
493
492
default :
494
- e2elog .Failf (invalidKind )
493
+ framework .Failf (invalidKind )
495
494
}
496
495
497
496
ginkgo .By (fmt .Sprintf ("Running controller" ))
0 commit comments