Skip to content
Permalink
Browse files

Fix func VerifyLatencyWithinThreshold() to local

  • Loading branch information
YuikoTakada committed Nov 22, 2019
1 parent 3c5dad6 commit cd7859901c66736028cec9f673025b1a98c6d2a0
Showing with 16 additions and 17 deletions.
  1. +0 −16 test/e2e/framework/metrics/latencies.go
  2. +16 −1 test/e2e_node/density_test.go
@@ -17,7 +17,6 @@ limitations under the License.
package metrics

import (
"fmt"
"math"
"time"

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

// VerifyLatencyWithinThreshold verifies whether 50, 90 and 99th percentiles of a latency metric are
// within the expected threshold.
func VerifyLatencyWithinThreshold(threshold, actual LatencyMetric, metricName string) error {
if actual.Perc50 > threshold.Perc50 {
return fmt.Errorf("too high %v latency 50th percentile: %v", metricName, actual.Perc50)
}
if actual.Perc90 > threshold.Perc90 {
return fmt.Errorf("too high %v latency 90th percentile: %v", metricName, actual.Perc90)
}
if actual.Perc99 > threshold.Perc99 {
return fmt.Errorf("too high %v latency 99th percentile: %v", metricName, actual.Perc99)
}
return nil
}

// PodLatencyData encapsulates pod startup latency information.
type PodLatencyData struct {
// Name of the pod
@@ -533,6 +533,21 @@ func createBatchPodSequential(f *framework.Framework, pods []*v1.Pod) (time.Dura
return batchLag, e2eLags
}

// verifyLatencyWithinThreshold verifies whether 50, 90 and 99th percentiles of a latency metric are
// within the expected threshold.
func verifyLatencyWithinThreshold(threshold, actual e2emetrics.LatencyMetric, metricName string) error {
if actual.Perc50 > threshold.Perc50 {
return fmt.Errorf("too high %v latency 50th percentile: %v", metricName, actual.Perc50)
}
if actual.Perc90 > threshold.Perc90 {
return fmt.Errorf("too high %v latency 90th percentile: %v", metricName, actual.Perc90)
}
if actual.Perc99 > threshold.Perc99 {
return fmt.Errorf("too high %v latency 99th percentile: %v", metricName, actual.Perc99)
}
return nil
}

// logAndVerifyLatency verifies that whether pod creation latency satisfies the limit.
func logAndVerifyLatency(batchLag time.Duration, e2eLags []e2emetrics.PodLatencyData, podStartupLimits e2emetrics.LatencyMetric,
podBatchStartupLimit time.Duration, testInfo map[string]string, isVerify bool) {
@@ -549,7 +564,7 @@ func logAndVerifyLatency(batchLag time.Duration, e2eLags []e2emetrics.PodLatency

if isVerify {
// check whether e2e pod startup time is acceptable.
framework.ExpectNoError(e2emetrics.VerifyLatencyWithinThreshold(podStartupLimits, podStartupLatency, "pod startup"))
framework.ExpectNoError(verifyLatencyWithinThreshold(podStartupLimits, podStartupLatency, "pod startup"))

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

0 comments on commit cd78599

Please sign in to comment.
You can’t perform that action at this time.