fix spaces around the /

This commit is contained in:
Shiyang Wang 2017-11-24 18:06:20 +08:00
parent 7b9affae66
commit f42f79edb0
2 changed files with 13 additions and 13 deletions

View File

@ -1483,20 +1483,20 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if len(statuses) > i && statuses[i].Pods != nil { if len(statuses) > i && statuses[i].Pods != nil {
current = statuses[i].Pods.CurrentAverageValue.String() current = statuses[i].Pods.CurrentAverageValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Pods.TargetAverageValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Pods.TargetAverageValue.String()))
case autoscaling.ObjectMetricSourceType: case autoscaling.ObjectMetricSourceType:
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Object != nil { if len(statuses) > i && statuses[i].Object != nil {
current = statuses[i].Object.CurrentValue.String() current = statuses[i].Object.CurrentValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Object.TargetValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Object.TargetValue.String()))
case autoscaling.ResourceMetricSourceType: case autoscaling.ResourceMetricSourceType:
if spec.Resource.TargetAverageValue != nil { if spec.Resource.TargetAverageValue != nil {
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Resource != nil { if len(statuses) > i && statuses[i].Resource != nil {
current = statuses[i].Resource.CurrentAverageValue.String() current = statuses[i].Resource.CurrentAverageValue.String()
} }
list = append(list, fmt.Sprintf("%s / %s", current, spec.Resource.TargetAverageValue.String())) list = append(list, fmt.Sprintf("%s/%s", current, spec.Resource.TargetAverageValue.String()))
} else { } else {
current := "<unknown>" current := "<unknown>"
if len(statuses) > i && statuses[i].Resource != nil && statuses[i].Resource.CurrentAverageUtilization != nil { if len(statuses) > i && statuses[i].Resource != nil && statuses[i].Resource.CurrentAverageUtilization != nil {
@ -1507,7 +1507,7 @@ func formatHPAMetrics(specs []autoscaling.MetricSpec, statuses []autoscaling.Met
if spec.Resource.TargetAverageUtilization != nil { if spec.Resource.TargetAverageUtilization != nil {
target = fmt.Sprintf("%d%%", *spec.Resource.TargetAverageUtilization) target = fmt.Sprintf("%d%%", *spec.Resource.TargetAverageUtilization)
} }
list = append(list, fmt.Sprintf("%s / %s", current, target)) list = append(list, fmt.Sprintf("%s/%s", current, target))
} }
default: default:
list = append(list, "<unknown type>") list = append(list, "<unknown type>")

View File

@ -2182,7 +2182,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// pods source type // pods source type
{ {
@ -2219,7 +2219,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50m / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50m/100m\t2\t10\t4\t<unknown>\n",
}, },
// object source type (no current) // object source type (no current)
{ {
@ -2251,7 +2251,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// object source type // object source type
{ {
@ -2296,7 +2296,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50m / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50m/100m\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetVal (no current) // resource source type, targetVal (no current)
{ {
@ -2324,7 +2324,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/100m\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetVal // resource source type, targetVal
{ {
@ -2361,7 +2361,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50m / 100m\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50m/100m\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetUtil (no current) // resource source type, targetUtil (no current)
{ {
@ -2389,7 +2389,7 @@ func TestPrintHPA(t *testing.T) {
DesiredReplicas: 5, DesiredReplicas: 5,
}, },
}, },
"some-hpa\tReplicationController/some-rc\t<unknown> / 80%\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t<unknown>/80%\t2\t10\t4\t<unknown>\n",
}, },
// resource source type, targetUtil // resource source type, targetUtil
{ {
@ -2427,7 +2427,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50% / 80%\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50%/80%\t2\t10\t4\t<unknown>\n",
}, },
// multiple specs // multiple specs
{ {
@ -2486,7 +2486,7 @@ func TestPrintHPA(t *testing.T) {
}, },
}, },
}, },
"some-hpa\tReplicationController/some-rc\t50m / 100m, 50% / 80% + 1 more...\t2\t10\t4\t<unknown>\n", "some-hpa\tReplicationController/some-rc\t50m/100m, 50%/80% + 1 more...\t2\t10\t4\t<unknown>\n",
}, },
} }