[v0.2.0] Run go test with -shuffle=on in CI

Open Beginner friendly
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
github-actions, go
Domain
ci-cd, testing

Research direction

Start with .github/workflows/ci.yml and the README Testing section. Run the existing go test -race command with -shuffle=on, then repeat it for five runs and use any reported seed for reproduction if needed. Done means CI includes shuffling, all five runs pass, and README Testing explains seed-based reproduction.

Written by the indexing model from the issue text.

Description

area:ci area:tests type:chore

Problem

The shared-anvil test pattern reuses one *Anvil instance across subtests, with ResetState between them. If a subtest accidentally relies on state set up by a previous one (instead of constructing its own), the tests pass in declaration order but break under reordering.

go test -shuffle=on runs tests in randomized order. Catching that drift is cheap and worth it.

Proposal

In .github/workflows/ci.yml, add -shuffle=on to the go test invocation:

- run: go test -race ./...
+ run: go test -race -shuffle=on ./...

Failures will print the seed; we can add -shuffle=<seed> to reproduce locally.

Acceptance criteria

  • CI runs -shuffle=on.
  • All tests pass with shuffling for at least 5 consecutive runs (i.e. the seed is properly random and we don't have hidden ordering deps).
  • README "Testing" section mentions the seed-reproduction trick.
Dominant language
Go
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from neverDefined/go-anvil

All issues in neverDefined/go-anvil

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.