Skip to content

Commit b38dfb3

Browse files
authored
Merge pull request kubernetes#85522 from YuikoTakada/local-latencies
Fix func VerifyLatencyWithinThreshold() to local
2 parents 3430201 + cd78599 commit b38dfb3

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

test/e2e/framework/metrics/latencies.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package metrics
1818

1919
import (
20-
"fmt"
2120
"math"
2221
"time"
2322

@@ -31,21 +30,6 @@ const (
3130
SingleCallTimeout = 5 * time.Minute
3231
)
3332

34-
// VerifyLatencyWithinThreshold verifies whether 50, 90 and 99th percentiles of a latency metric are
35-
// within the expected threshold.
36-
func VerifyLatencyWithinThreshold(threshold, actual LatencyMetric, metricName string) error {
37-
if actual.Perc50 > threshold.Perc50 {
38-
return fmt.Errorf("too high %v latency 50th percentile: %v", metricName, actual.Perc50)
39-
}
40-
if actual.Perc90 > threshold.Perc90 {
41-
return fmt.Errorf("too high %v latency 90th percentile: %v", metricName, actual.Perc90)
42-
}
43-
if actual.Perc99 > threshold.Perc99 {
44-
return fmt.Errorf("too high %v latency 99th percentile: %v", metricName, actual.Perc99)
45-
}
46-
return nil
47-
}
48-
4933
// PodLatencyData encapsulates pod startup latency information.
5034
type PodLatencyData struct {
5135
// Name of the pod

test/e2e_node/density_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,21 @@ func createBatchPodSequential(f *framework.Framework, pods []*v1.Pod) (time.Dura
533533
return batchLag, e2eLags
534534
}
535535

536+
// verifyLatencyWithinThreshold verifies whether 50, 90 and 99th percentiles of a latency metric are
537+
// within the expected threshold.
538+
func verifyLatencyWithinThreshold(threshold, actual e2emetrics.LatencyMetric, metricName string) error {
539+
if actual.Perc50 > threshold.Perc50 {
540+
return fmt.Errorf("too high %v latency 50th percentile: %v", metricName, actual.Perc50)
541+
}
542+
if actual.Perc90 > threshold.Perc90 {
543+
return fmt.Errorf("too high %v latency 90th percentile: %v", metricName, actual.Perc90)
544+
}
545+
if actual.Perc99 > threshold.Perc99 {
546+
return fmt.Errorf("too high %v latency 99th percentile: %v", metricName, actual.Perc99)
547+
}
548+
return nil
549+
}
550+
536551
// logAndVerifyLatency verifies that whether pod creation latency satisfies the limit.
537552
func logAndVerifyLatency(batchLag time.Duration, e2eLags []e2emetrics.PodLatencyData, podStartupLimits e2emetrics.LatencyMetric,
538553
podBatchStartupLimit time.Duration, testInfo map[string]string, isVerify bool) {
@@ -549,7 +564,7 @@ func logAndVerifyLatency(batchLag time.Duration, e2eLags []e2emetrics.PodLatency
549564

550565
if isVerify {
551566
// check whether e2e pod startup time is acceptable.
552-
framework.ExpectNoError(e2emetrics.VerifyLatencyWithinThreshold(podStartupLimits, podStartupLatency, "pod startup"))
567+
framework.ExpectNoError(verifyLatencyWithinThreshold(podStartupLimits, podStartupLatency, "pod startup"))
553568

554569
// check bactch pod creation latency
555570
if podBatchStartupLimit > 0 {

0 commit comments

Comments
 (0)