MCPcopy
hub / github.com/ddworken/hishtory / wrapTestForSharding

Function wrapTestForSharding

client/testutils.go:379–386  ·  view source on GitHub ↗

Wrap the given test so that it can be run on Github Actions with sharding. This makes it possible to run only 1/N tests on each of N github action jobs, speeding up test execution through parallelization. This is necessary since the wrapped integration tests rely on OS-level globals (the shell histo

(test func(t *testing.T))

Source from the content-addressed store, hash-verified

377// integration tests rely on OS-level globals (the shell history) that can't otherwise
378// be parallelized.
379func wrapTestForSharding(test func(t *testing.T)) func(t *testing.T) {
380 shardNumberAllocator += 1
381 return func(t *testing.T) {
382 testShardNumber := shardNumberAllocator
383 markTestForSharding(t, testShardNumber)
384 test(t)
385 }
386}
387
388var shardNumberAllocator int = 0
389

Callers 1

TestParamFunction · 0.85

Calls 1

markTestForShardingFunction · 0.85

Tested by 1

TestParamFunction · 0.68