@@ -71,6 +71,9 @@ var _ = SIGDescribe("Service endpoints latency", func() {
71
71
totalTrials = 200
72
72
parallelTrials = 15
73
73
minSampleSize = 100
74
+
75
+ // Acceptable failure ratio for getting service latencies.
76
+ acceptableFailureRatio = .05
74
77
)
75
78
76
79
// Turn off rate limiting--it interferes with our measurements.
@@ -79,7 +82,7 @@ var _ = SIGDescribe("Service endpoints latency", func() {
79
82
defer func () { f .ClientSet .CoreV1 ().RESTClient ().(* restclient.RESTClient ).Throttle = oldThrottle }()
80
83
81
84
failing := sets .NewString ()
82
- d , err := runServiceLatencies (f , parallelTrials , totalTrials )
85
+ d , err := runServiceLatencies (f , parallelTrials , totalTrials , acceptableFailureRatio )
83
86
if err != nil {
84
87
failing .Insert (fmt .Sprintf ("Not all RC/pod/service trials succeeded: %v" , err ))
85
88
}
@@ -123,7 +126,7 @@ var _ = SIGDescribe("Service endpoints latency", func() {
123
126
})
124
127
})
125
128
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 ) {
127
130
cfg := testutils.RCConfig {
128
131
Client : f .ClientSet ,
129
132
InternalClient : f .InternalClientset ,
@@ -180,7 +183,11 @@ func runServiceLatencies(f *framework.Framework, inParallel, total int) (output
180
183
}
181
184
}
182
185
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
+ }
184
191
}
185
192
return output , nil
186
193
}
0 commit comments