Skip to content

Commit 08e406b

Browse files
committed
[e2e] Add acceptableFailureRatio to service latencies test
1 parent 1eb2acc commit 08e406b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/e2e/network/service_latency.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ var _ = SIGDescribe("Service endpoints latency", func() {
7171
totalTrials = 200
7272
parallelTrials = 15
7373
minSampleSize = 100
74+
75+
// Acceptable failure ratio for getting service latencies.
76+
acceptableFailureRatio = .05
7477
)
7578

7679
// Turn off rate limiting--it interferes with our measurements.
@@ -79,7 +82,7 @@ var _ = SIGDescribe("Service endpoints latency", func() {
7982
defer func() { f.ClientSet.CoreV1().RESTClient().(*restclient.RESTClient).Throttle = oldThrottle }()
8083

8184
failing := sets.NewString()
82-
d, err := runServiceLatencies(f, parallelTrials, totalTrials)
85+
d, err := runServiceLatencies(f, parallelTrials, totalTrials, acceptableFailureRatio)
8386
if err != nil {
8487
failing.Insert(fmt.Sprintf("Not all RC/pod/service trials succeeded: %v", err))
8588
}
@@ -123,7 +126,7 @@ var _ = SIGDescribe("Service endpoints latency", func() {
123126
})
124127
})
125128

126-
func runServiceLatencies(f *framework.Framework, inParallel, total int) (output []time.Duration, err error) {
129+
func runServiceLatencies(f *framework.Framework, inParallel, total int, acceptableFailureRatio float32) (output []time.Duration, err error) {
127130
cfg := testutils.RCConfig{
128131
Client: f.ClientSet,
129132
InternalClient: f.InternalClientset,
@@ -180,7 +183,11 @@ func runServiceLatencies(f *framework.Framework, inParallel, total int) (output
180183
}
181184
}
182185
if errCount != 0 {
183-
return output, fmt.Errorf("got %v errors", errCount)
186+
framework.Logf("Got %d errors out of %d tries", errCount, total)
187+
errRatio := float32(errCount) / float32(total)
188+
if errRatio > acceptableFailureRatio {
189+
return output, fmt.Errorf("error ratio %g is higher than the acceptable ratio %g", errRatio, acceptableFailureRatio)
190+
}
184191
}
185192
return output, nil
186193
}

0 commit comments

Comments
 (0)