mirror of
https://github.com/pgsty/minio.git
synced 2026-11-11 01:55:30 +03:00
fix(ilm): trace refused expiries with their error; harden the tests
The implementation review of this round's public fixes found one gap in the code and four in the tests. - A refused expiry was traced with its reason but without its error, so the trace did not say what refused it. It now carries the error, as a failed one does. - The restore MRF test replaced the live MRF channel, which the heal routines of the test servers read: a race, and a consumer could take the entry under test. addPartialOp now offers an atomic hook that receives the operation in place of the queue. Production never sets it. - Two fixtures restored the storage class with Update, which marks an uninitialized configuration initialized and so changes the default parity (-1) into an explicit 0 for later tests. setTestStandardParity restores the whole saved value under storageclass.ConfigLock. - The v3 metric test built its own descriptor map, so dropping the counter from the registered ILM collector still passed. It gathers through the collector the handler registers. - The audit test read one extra entry or waited 500 ms. It drains every entry of the bucket up to the removal audited last, and checks one failure audit, one removal audit and no refusal audit per object. Each corrected test fails with the corresponding mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -30,15 +30,29 @@ import (
|
||||
// is decided again under the object lock and can be refused, and a version
|
||||
// left unhealed would stay without the replaced drive for as long as it is.
|
||||
|
||||
// setTestStandardParity sets the standard storage class parity for the test
|
||||
// and restores the whole previous configuration after it, also when it was
|
||||
// never initialized and so meant the default parity.
|
||||
func setTestStandardParity(t *testing.T, parity int) {
|
||||
t.Helper()
|
||||
storageclass.ConfigLock.RLock()
|
||||
saved := globalStorageClass
|
||||
storageclass.ConfigLock.RUnlock()
|
||||
globalStorageClass.Update(storageclass.Config{Standard: storageclass.StorageClass{Parity: parity}})
|
||||
t.Cleanup(func() {
|
||||
storageclass.ConfigLock.Lock()
|
||||
globalStorageClass = saved
|
||||
storageclass.ConfigLock.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
// startTestBackgroundHeal registers the background heal sequence and a heal
|
||||
// worker, which drive healing needs for its bucket heals.
|
||||
func startTestBackgroundHeal(t *testing.T, z *erasureServerPools) {
|
||||
t.Helper()
|
||||
// The healed drive is rebuilt from parity. Earlier tests can leave a
|
||||
// storage class of parity 0 behind (newTestConfig on a single drive).
|
||||
previous := globalStorageClass
|
||||
globalStorageClass.Update(storageclass.Config{Standard: storageclass.StorageClass{Parity: z.serverPools[0].setDriveCount / 2}})
|
||||
t.Cleanup(func() { globalStorageClass.Update(previous) })
|
||||
setTestStandardParity(t, z.serverPools[0].setDriveCount/2)
|
||||
if globalBackgroundHealState == nil {
|
||||
globalBackgroundHealState = newHealState(GlobalContext, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user