mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-01 09:50:39 +01:00
fix(shell): compare fractional evacuation destination ratios (#11752)
This commit is contained in:
1 parent
9e56651808
commit
e12ec94747
2 files changed
+18
-1
No files matched your search
@@ -5,6 +5,22 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEvacuatePrefersLowerVolumeRatio(t *testing.T) {
|
||||
volumes := mkByteVolumes(1, 1, 1)
|
||||
source := makeByteNode("source", 10, 0, 0, volumes)
|
||||
fuller := makeByteNode("fuller", 10, 0, 0, mkByteVolumes(10, 4, 1))
|
||||
emptier := makeByteNode("emptier", 10, 0, 0, mkByteVolumes(20, 2, 1))
|
||||
|
||||
// Put the 40%-full server first: truncating 0.2 - 0.4 to int makes the ratios tie.
|
||||
moved, err := moveAwayOneNormalVolume(nil, nil, volumes[0], source, []*Node{fuller, emptier}, false)
|
||||
if err != nil || !moved {
|
||||
t.Fatalf("evacuate: moved=%v, err=%v", moved, err)
|
||||
}
|
||||
if _, found := emptier.selectedVolumes[volumes[0].Id]; !found {
|
||||
t.Fatal("expected evacuation to choose the server with lower occupancy")
|
||||
}
|
||||
}
|
||||
|
||||
func TestVolumeServerEvacuate(t *testing.T) {
|
||||
targetServer := ""
|
||||
volumeRack := "rack1"
|
||||
|
||||
Reference in new issue
Block a user