mirror of
https://github.com/pgsty/minio.git
synced 2026-11-10 17:45:32 +03:00
fix(decom): preserve cancellation during finalization
Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -197,3 +197,29 @@ func TestPoolMetaValidate(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPoolMetaDecommissionCancellationIsTerminal(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
canceled := poolMeta{Pools: []PoolStatus{{Decommission: &PoolDecommissionInfo{}}}}
|
||||
if !canceled.DecommissionCancel(0) {
|
||||
t.Fatal("failed to record cancellation")
|
||||
}
|
||||
if canceled.DecommissionFailed(0) {
|
||||
t.Fatal("a canceled decommission was changed to failed")
|
||||
}
|
||||
if canceled.DecommissionComplete(0) {
|
||||
t.Fatal("a canceled decommission was changed to complete")
|
||||
}
|
||||
if got := canceled.returnResumablePools(); len(got) != 0 {
|
||||
t.Fatalf("canceled decommission is resumable: %+v", got)
|
||||
}
|
||||
|
||||
failed := poolMeta{Pools: []PoolStatus{{Decommission: &PoolDecommissionInfo{}}}}
|
||||
if !failed.DecommissionFailed(0) {
|
||||
t.Fatal("failed to record failure")
|
||||
}
|
||||
if got := failed.returnResumablePools(); len(got) != 1 {
|
||||
t.Fatalf("failed decommission is not resumable: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user