From c053ef2a3192ba95ceecd4e03ac3b47dc4a53e9e Mon Sep 17 00:00:00 2001 From: Wojciech Tyczynski Date: Wed, 28 Oct 2015 15:41:47 +0100 Subject: [PATCH] Fix computing of percentiles in Density test --- test/e2e/density.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e/density.go b/test/e2e/density.go index 696a2292386..4b52cadb01d 100644 --- a/test/e2e/density.go +++ b/test/e2e/density.go @@ -63,9 +63,10 @@ func (a latencySlice) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a latencySlice) Less(i, j int) bool { return a[i].Latency < a[j].Latency } func extractLatencyMetrics(latencies []podLatencyData) LatencyMetric { - perc50 := latencies[len(latencies)/2].Latency - perc90 := latencies[(len(latencies)*9)/10].Latency - perc99 := latencies[(len(latencies)*99)/100].Latency + length := len(latencies) + perc50 := latencies[int(math.Ceil(float64(length*50)/100))-1].Latency + perc90 := latencies[int(math.Ceil(float64(length*90)/100))-1].Latency + perc99 := latencies[int(math.Ceil(float64(length*99)/100))-1].Latency return LatencyMetric{Perc50: perc50, Perc90: perc90, Perc99: perc99} }