chore(tests): return a copy of the map to avoid concurrency issues in tests (#58547)

This commit is contained in:
Kristin Laemmert
2022-11-09 16:12:18 -05:00
committed by GitHub
parent 2bfdda5b68
commit 70dac35348

View File

@@ -93,6 +93,9 @@ func (repo *fakeAnnotationsRepo) Len() int {
func (repo *fakeAnnotationsRepo) Items() map[int64]annotations.Item {
repo.mtx.Lock()
defer repo.mtx.Unlock()
return repo.annotations
ret := make(map[int64]annotations.Item)
for k, v := range repo.annotations {
ret[k] = v
}
return ret
}