fix golint error

This commit is contained in:
danielqsj 2019-11-06 22:58:55 +08:00
parent b7b1055bf4
commit 32aaea1baf

View File

@ -104,6 +104,7 @@ type ResourceConsumer struct {
requestSizeCustomMetric int requestSizeCustomMetric int
} }
// GetResourceConsumerImage is a wrapper to get the fully qualified URI of the ResourceConsumer image
func GetResourceConsumerImage() string { func GetResourceConsumerImage() string {
return resourceConsumerImage return resourceConsumerImage
} }
@ -185,7 +186,7 @@ func (rc *ResourceConsumer) ConsumeMem(megabytes int) {
rc.mem <- megabytes rc.mem <- megabytes
} }
// ConsumeMem consumes given number of custom metric // ConsumeCustomMetric consumes given number of custom metric
func (rc *ResourceConsumer) ConsumeCustomMetric(amount int) { func (rc *ResourceConsumer) ConsumeCustomMetric(amount int) {
framework.Logf("RC %s: consume custom metric %v in total", rc.name, amount) framework.Logf("RC %s: consume custom metric %v in total", rc.name, amount)
rc.customMetric <- amount rc.customMetric <- amount
@ -364,11 +365,12 @@ func (rc *ResourceConsumer) GetReplicas() int {
return 0 return 0
} }
// GetReplicas get the corresponding horizontalPodAutoscaler object // GetHpa get the corresponding horizontalPodAutoscaler object
func (rc *ResourceConsumer) GetHpa(name string) (*autoscalingv1.HorizontalPodAutoscaler, error) { func (rc *ResourceConsumer) GetHpa(name string) (*autoscalingv1.HorizontalPodAutoscaler, error) {
return rc.clientSet.AutoscalingV1().HorizontalPodAutoscalers(rc.nsName).Get(name, metav1.GetOptions{}) return rc.clientSet.AutoscalingV1().HorizontalPodAutoscalers(rc.nsName).Get(name, metav1.GetOptions{})
} }
// WaitForReplicas wait for the desired replicas
func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int, duration time.Duration) { func (rc *ResourceConsumer) WaitForReplicas(desiredReplicas int, duration time.Duration) {
interval := 20 * time.Second interval := 20 * time.Second
err := wait.PollImmediate(interval, duration, func() (bool, error) { err := wait.PollImmediate(interval, duration, func() (bool, error) {