Change:
<!-- Please only use this template for submitting reports about flaky tests or jobs (pass or fail with no underlying change in code) in Kubernetes CI --Which test(s) are flaking: Testgrid link: While there aren't any visible failures in the above testgrid link, we've observed flaky timeouts downstream. Reason for failure: Test times out Anything else we need to know: We don't have full logs for failed unit tests, so it's hard to pinpoint exactly which test is timing out, but I believe the offending function is this: You will see that the test iterates times: Summing up the hashMax for all four subtests, we see that the function iterates ~34 million times. While the test takes just ~9 seconds on my machine to complete, the CI is probably struggling with it (other tests are running in parallel and iterating 34 million times over a non-trivial loop is very CPU hungry). A successful execution of the unit test on CI takes ~3-4 minutes on average. The test doesn't have any of the usual suspects that can cause a timeout (like <-chan receive, i/o reads, wait.Poll(), time.Sleep(), etc.), so I suspect the large number of iterations to be the culprit. I propose making the unit test smaller and quicker to complete. Hopefully someone who understands shufflesharding better than me can take over :) /sig api-machinery /cc
when run with , the runtime increases significantly: that time is dominated by TestUniformDistribution
The test does a lot of slice appends. Maybe is constraining the allocator? There isn't much else in the test that might be slowed down by : no mutexes, no RNGs, no atomic operations, no channels, etc.
It looks like the buffer is pre-allocated to be the correct size though, so none of those appends should be resulting in allocations?
/triage accepted
BTW, in another branch I tried taking the s out of the test, instead calling with a lambda that writes into at a position selected by an advancing index. The got a little slower!

Discussion:
}{ {64, 3, 1 << uint(math.Ceil(math.Log2(float64(ff(64, 3))))+spare)}, {128, 3, ff(128, 3)}, <del> {128, 3, 3 * ff(128, 3)}, {70, 4, ff(70, 4)}, </del> <ins> {50, 4, ff(50, 4)}, </ins> } for _, test := range tests { dealer, err := NewDealer(test.deckSize, test.handSize)

} handCoordinateMap[handCoordinate]++ } <ins> numHandsSeen := len(handCoordinateMap) </ins> <del> t.Logf("Deck size = %v, hand size = %v, number of possible hands = %d, number of hands seen = %d, number of deals = %d, expected count range = [%v, %v]", test.deckSize, test.handSize, allCoordinateCount, len(handCoordinateMap), test.hashMax, minCount, maxCount) </del> <ins> t.Logf("Deck size = %v, hand size = %v, number of possible hands = %d, number of hands seen = %d, number of deals = %d, expected count range = [%v, %v]", test.deckSize, test.handSize, allCoordinateCount, numHandsSeen, test.hashMax, minCount, maxCount) </ins> // histogram maps (count of times a hand is seen) to (number of hands having that count) histogram := make(map[int]int)

goodSum += histogram[count] } <del> goodPct := 100 * float64(goodSum) / float64(allCoordinateCount) </del> <ins> goodPct := 100 * float64(goodSum) / float64(numHandsSeen) </ins> t.Logf("good percentage = %v, histogram = %v", goodPct, histogram) <del> if goodSum != allCoordinateCount { </del> <ins> if goodSum != numHandsSeen { </ins> t.Errorf("Only %v percent of the hands got a central count", goodPct) } }