fix race & prettier test output

This commit is contained in:
Pavel 2024-06-14 18:17:54 +03:00
parent 90e9de051a
commit ca47e757bc
2 changed files with 4 additions and 2 deletions

View File

@ -46,7 +46,9 @@ jobs:
- name: Get dependencies - name: Get dependencies
run: go mod tidy run: go mod tidy
- name: Tests - name: Tests
run: go test ./... -v -cpu 2 -timeout 30s -race -cover -coverprofile=coverage.txt -covermode=atomic run: |
go install gotest.tools/gotestsum@latest
gotestsum --format testdox ./... -v -cpu 2 -timeout 30s -race -cover -coverprofile=coverage.txt -covermode=atomic
- name: Coverage - name: Coverage
run: | run: |
go install github.com/axw/gocov/gocov@latest go install github.com/axw/gocov/gocov@latest

View File

@ -102,7 +102,6 @@ func (l *LocalizerTest) Test_LocalizationMiddleware_Context() {
func (l *LocalizerTest) Test_LocalizationMiddleware_Httptest() { func (l *LocalizerTest) Test_LocalizationMiddleware_Httptest() {
var wg sync.WaitGroup var wg sync.WaitGroup
r := rand.New(rand.NewSource(time.Now().UnixNano())) // nolint:gosec
l.localizer.Preload(DefaultLanguages) l.localizer.Preload(DefaultLanguages)
langMsgMap := map[language.Tag]string{ langMsgMap := map[language.Tag]string{
language.English: "Test message", language.English: "Test message",
@ -120,6 +119,7 @@ func (l *LocalizerTest) Test_LocalizationMiddleware_Httptest() {
for i := 0; i < 1000; i++ { for i := 0; i < 1000; i++ {
wg.Add(1) wg.Add(1)
go func(m map[language.Tag]string, wg *sync.WaitGroup) { go func(m map[language.Tag]string, wg *sync.WaitGroup) {
r := rand.New(rand.NewSource(time.Now().UnixNano() + int64(i))) // nolint:gosec
var tag language.Tag var tag language.Tag
switch r.Intn(3-1) + 1 { // nolint:gosec switch r.Intn(3-1) + 1 { // nolint:gosec
case 1: case 1: