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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}