Open
Description
Description
In our tests we initialize multiple meilisearch clients concurrently. Running our go tests with -count 5 -race
predicatably returns a data race error for meilisearch.New()
as it concurrently modifies the default options:
Lines 19 to 23 in e56172a
Expected behavior
meilisearch.New()
should be callable concurrently by multiple goroutines in tests.
I think the easiest fix is to copy the defaultOptions instead of using a reference.
Current behavior
WARNING: DATA RACE
Write at 0x000104aeac48 by goroutine 58:
github.com/gramLabs/stormforge-cloud/pkg/testutil.WithMeilisearch.WithAPIKey.func4()
/Users/zeisss/go/pkg/mod/github.com/meilisearch/[email protected]/options.go:65 +0x40
github.com/meilisearch/meilisearch-go.New()
/Users/zeisss/go/pkg/mod/github.com/meilisearch/[email protected]/meilisearch.go:22 +0x78
github.com/redacted/my-project/pkg/testutil.WithMeilisearch()
/Users/zeisss/p/redacted/my-project/pkg/testutil/meilisearch.go:60 +0x54c
Environment (please complete the following information):
- OS: Mac
- meilisearch-go version: v0.31.0