From 75250eb9e78654c40fa920a1e0dbf9f473226775 Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Fri, 13 May 2022 12:34:43 +0000 Subject: [PATCH] Skip due to poor Actions consistency --- performance_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/performance_test.go b/performance_test.go index d05e781..4c99e7e 100644 --- a/performance_test.go +++ b/performance_test.go @@ -3,6 +3,7 @@ package discovery import ( "context" "math" + "os" "sync" "testing" "time" @@ -71,6 +72,10 @@ func (s *SlowSource) Weight() int { } func TestParallelRequestPerformance(t *testing.T) { + if os.Getenv("GITHUB_ACTIONS") != "" { + t.Skip("Performance tests under github actions are too unreliable") + } + // This test is designed to ensure that request duration is linear up to a // certain point. Above that point the overhead caused by having so many // goroutines running will start to make the response times non-linear which @@ -134,12 +139,8 @@ func TimeRequests(numRequests int, linkDepth int, numParallel int) TimedResults for i := 0; i <= linkDepth; i++ { thisLayer := int(math.Pow(2, float64(i))) * numRequests - // Expect that it'll take no longer that 200% of the sleep time. This is - // actually quite a lot of slack, and you likely won't need this much - // when running tests locally. But testing on shared platforms like - // Github actions you can see some pretty serious slowdowns that don't - // seem to be related to the tests - thisDuration := 200 * math.Ceil(float64(thisLayer)/float64(numParallel)) + // Expect that it'll take no longer that 120% of the sleep time. + thisDuration := 120 * math.Ceil(float64(thisLayer)/float64(numParallel)) expectedDuration = expectedDuration + (time.Duration(thisDuration) * time.Millisecond) expectedItems = expectedItems + thisLayer }