Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfec371b

Browse files
authored
Pre-emptively prevent test fixtures from lingering global state (#616)
`count=2` is very effective at sniffing out global state/singletons that don't get unset properly by a test's cleanup.We started doing this at a previous employer and discovered all sorts of tests that were leaving global singleton artifacts around and other tests had started to depend on them... it took a while to untangle, but we were very glad once we finally got through it.
1 parentaebc643 commitfec371b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎.github/workflows/go.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ jobs:
2828
run:go build -v -buildvcs=false ./...
2929

3030
-name:Test
31-
run:go test -p 1 -v -shuffle=on ./...
31+
# -count=2 ensures that test fixtures cleanup after themselves
32+
# because any leftover state will generally cause the second run to fail.
33+
run:go test -p 1 -v -shuffle=on -count=2 ./...
3234

3335
-name:Linter
3436
uses:golangci/golangci-lint-action@v6

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp