facebookarchive / rocks-strata

Other
133 stars 24 forks source link

Fix thread-unsafe unit test #31

Closed AGFeldman closed 7 years ago

AGFeldman commented 7 years ago

https://github.com/facebookgo/rocks-strata/pull/28 and https://github.com/facebookgo/rocks-strata/pull/30 both encountered this issue: MockStorage.PutReader is not thread-safe. The issue only affects unit tests. It is visible in go versions 1.6+, which check for concurrent map writes at runtime.

Fix by protecting the map with a read/write lock.

AGFeldman commented 7 years ago

Merging without review. The change is simple and only affects unit tests