From 85d96ba941156d7638e67e20bc9a91783901e38b Mon Sep 17 00:00:00 2001 From: Victor Elias Date: Mon, 20 Dec 2021 13:09:52 -0300 Subject: [PATCH] health-tester: Make sure to compare health with same time Otherwise absolutely every error message is going to be slightly different. --- internal/testers/stream_health.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/testers/stream_health.go b/internal/testers/stream_health.go index 9ea9a974..4e66095f 100644 --- a/internal/testers/stream_health.go +++ b/internal/testers/stream_health.go @@ -100,6 +100,7 @@ type checkResult struct { func (h *streamHealth) checkAllRegions(logErrs bool) <-chan checkResult { results := make(chan checkResult, 2) wg := sync.WaitGroup{} + startTime := time.Now() for region := range h.clients { wg.Add(1) go func(region string) { @@ -112,7 +113,7 @@ func (h *streamHealth) checkAllRegions(logErrs bool) <-chan checkResult { err = fmt.Errorf("`healthy` condition unavailable") } else if !*healthy { err = fmt.Errorf("`healthy` condition is `false`") - } else if age := time.Since(health.Healthy.LastProbeTime.Time); age > time.Minute { + } else if age := startTime.Sub(health.Healthy.LastProbeTime.Time); age > time.Minute { err = fmt.Errorf("stream health is outdated (`%s`)", age) } if err != nil && (logErrs || bool(glog.V(model.VVERBOSE))) {