From: Martina Ferrari <tina@debian.org>
Date: Wed, 13 Jul 2016 16:04:13 +0100
Subject: Fix flaky tests

Bug-Debian: https://bugs.debian.org/830936
Forwarded: https://github.com/prometheus/alertmanager/issues/427
Last-Update: 2019-10-29

dispatch_test.go: Apparently, some signal is being delivered a few
  microseconds too early. This patch allows for a 10% difference in timing.
---
 dispatch/dispatch_test.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dispatch/dispatch_test.go b/dispatch/dispatch_test.go
index 913032c..ac3288a 100644
--- a/dispatch/dispatch_test.go
+++ b/dispatch/dispatch_test.go
@@ -175,7 +175,7 @@ func TestAggrGroup(t *testing.T) {
 			lastCurMtx.Lock()
 			s := time.Since(last)
 			lastCurMtx.Unlock()
-			if s < opts.GroupInterval {
+			if s < opts.GroupInterval * 90 / 100 {
 				t.Fatalf("received batch too early after %v", s)
 			}
 			exp := removeEndsAt(types.AlertSlice{a1, a3})
@@ -225,7 +225,7 @@ func TestAggrGroup(t *testing.T) {
 			lastCurMtx.Lock()
 			s := time.Since(last)
 			lastCurMtx.Unlock()
-			if s < opts.GroupInterval {
+			if s < opts.GroupInterval * 90 / 100 {
 				t.Fatalf("received batch too early after %v", s)
 			}
 			exp := removeEndsAt(types.AlertSlice{a1, a2, a3})
@@ -250,7 +250,7 @@ func TestAggrGroup(t *testing.T) {
 		lastCurMtx.Lock()
 		s := time.Since(last)
 		lastCurMtx.Unlock()
-		if s < opts.GroupInterval {
+		if s < opts.GroupInterval * 90 / 100 {
 			t.Fatalf("received batch too early after %v", s)
 		}
 		sort.Sort(batch)
