test(bolt): fix data race

Multiple goroutines were concurrently setting bolt.HashCost. Move the
assignment to an init function to avoid the data race.
pull/10616/head
Mark Rushakoff 2018-11-09 14:13:02 -08:00 committed by Mark Rushakoff
parent ed4bba83f5
commit 6874607796
1 changed files with 4 additions and 1 deletions

View File

@ -12,9 +12,12 @@ import (
"golang.org/x/crypto/bcrypt"
)
func init() {
bolt.HashCost = bcrypt.MinCost
}
func NewTestClient() (*bolt.Client, func(), error) {
c := bolt.NewClient()
bolt.HashCost = bcrypt.MinCost
f, err := ioutil.TempFile("", "influxdata-platform-bolt-")
if err != nil {