Skip to content

Update go test#1187

Draft
gammazero wants to merge 3 commits into
mainfrom
update-go-test
Draft

Update go test#1187
gammazero wants to merge 3 commits into
mainfrom
update-go-test

Conversation

@gammazero

@gammazero gammazero commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🧪 Tests use new go-test and math/rand/v2

The new go-test is upgraded to use math/rand/v2 in all of its packages. The /go-test/random package now allows reuse of the random number generator for more efficiently generating sets of random values.

Additionally, the /go-test/random package removes support for a global seed for the random number generator. This led to the possibility of multiple tests setting the global seed to generate deterministic values, and breaking other tests by causing the generator to generate unexpected values. This breakage could be intermittent and difficult to debug, depending on the how/which tests ran at the same time.

Since the underlying pseudo-random number generator was changed in the go-test module, the data generated for a given seed also changed. This required updating tests that relied on seeding the generator and getting expected values.

  • Use new go-test/random API
    • no global seed values
    • reuse generator where appropriate
  • Fix tests to match new random data generation
    • update expected deterministic values
    • fix t0043-add-w.sh
    • fix t0270-filestore.sh
  • Migrate from /math/rand' to /math/rand/v2`
    • random seeds are now [32]byte and not uint64

gammazero added 2 commits July 9, 2026 05:38
Replace all use of `math/rand` with `math/rand/v2`
@socket-security

socket-security Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgithub.com/​ipfs/​go-test@​v0.3.0 ⏵ v0.3.1-0.20260709160526-27b54c53fe50100 +1100100100100

View full report

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.82%. Comparing base (1bb7b20) to head (8e07a7b).

Files with missing lines Patch % Lines
gateway/blockstore.go 0.00% 4 Missing ⚠️
gateway/value_store.go 0.00% 4 Missing ⚠️
examples/bitswap-transfer/main.go 0.00% 3 Missing ⚠️
autoconf/client.go 0.00% 1 Missing ⚠️
autoconf/expansion.go 0.00% 1 Missing ⚠️
bitswap/testnet/rate_limit_generators.go 0.00% 1 Missing ⚠️
chunker/gen/main.go 0.00% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1187      +/-   ##
==========================================
- Coverage   63.87%   63.82%   -0.06%     
==========================================
  Files         269      269              
  Lines       27078    27082       +4     
==========================================
- Hits        17297    17286      -11     
- Misses       8073     8084      +11     
- Partials     1708     1712       +4     
Files with missing lines Coverage Δ
...wap/client/internal/session/peerresponsetracker.go 95.45% <ø> (ø)
bitswap/client/internal/session/sessionwants.go 92.13% <100.00%> (ø)
...itswap/testnet/internet_latency_delay_generator.go 88.88% <100.00%> (ø)
bootstrap/bootstrap.go 34.23% <ø> (ø)
gateway/backend_car_fetcher.go 81.01% <100.00%> (+0.49%) ⬆️
ipld/unixfs/test/utils.go 50.94% <100.00%> (ø)
peering/peering.go 73.97% <100.00%> (ø)
routing/mock/centralized_server.go 100.00% <100.00%> (ø)
util/util.go 21.05% <ø> (+2.00%) ⬆️
autoconf/client.go 60.00% <0.00%> (ø)
... and 6 more

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant