mirror of
https://github.com/pgsty/minio.git
synced 2026-11-10 09:35:31 +03:00
test(pools): make the copy and bulk lock tests race-free and stricter
The implementation review of the lock fixes found test flaws, which are corrected here; the production behavior is unchanged. - The alias and merge tests replaced globalOperationTimeout while background healing reads it, a data race under -race. They now bound each request with its own context instead. - The alias test now holds the cleaned name's write lock while the copy runs, so it proves the names are checked before anything is locked; it checks both objects before any later write, and covers a/./x as a destination. - The merge test picks aliases that hash to the clean name's set and, where sets have their own lockers, ones that do not, and requires the alias's own table to hold a read lock: readers admitted, writers excluded. - Release polling creates a fresh lock instance for every probe. - The getNSLocks event hook and the bulk delete group limit are atomic, so tests can set them while other goroutines read them. Without the name check and the resource merge, both tests now fail in every lock layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -122,9 +122,8 @@ func TestDeleteObjectsInSetsRunsGroupsConcurrently(t *testing.T) {
|
||||
// the result its own delete reports, and a group that completed before keeps
|
||||
// its success.
|
||||
func TestDeleteObjectsInSetsQueuedGroupsCancel(t *testing.T) {
|
||||
prev := deleteSetGroupsLimit
|
||||
deleteSetGroupsLimit = 1
|
||||
t.Cleanup(func() { deleteSetGroupsLimit = prev })
|
||||
deleteSetGroupsLimit.Store(1)
|
||||
t.Cleanup(func() { deleteSetGroupsLimit.Store(0) })
|
||||
for _, blocked := range []int{0, 1} {
|
||||
t.Run(fmt.Sprintf("blocked=%d", blocked), func(t *testing.T) {
|
||||
z, bucket := bulkDeletePools(t, 1)
|
||||
|
||||
Reference in New Issue
Block a user