diff options
| author | chrislu <chris.lu@gmail.com> | 2024-04-08 11:03:14 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-04-08 11:03:14 -0700 |
| commit | cc1c69f312a967dfb636a677db910eb64ab65a06 (patch) | |
| tree | 086fa2b7ce6e7b80c4a00516cba2810655579709 /weed/topology/volume_growth_test.go | |
| parent | ccdd9cd8decf66089ac201b7c2ca1f5889582b93 (diff) | |
| parent | f08f95ac800b788e42290e58eb6444e094acf97f (diff) | |
| download | seaweedfs-cc1c69f312a967dfb636a677db910eb64ab65a06.tar.xz seaweedfs-cc1c69f312a967dfb636a677db910eb64ab65a06.zip | |
Merge branch 'master' into mq-subscribe
Diffstat (limited to 'weed/topology/volume_growth_test.go')
| -rw-r--r-- | weed/topology/volume_growth_test.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/weed/topology/volume_growth_test.go b/weed/topology/volume_growth_test.go index a3473c677..04c5e8aeb 100644 --- a/weed/topology/volume_growth_test.go +++ b/weed/topology/volume_growth_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "github.com/seaweedfs/seaweedfs/weed/storage/types" + "github.com/seaweedfs/seaweedfs/weed/util" "testing" "github.com/seaweedfs/seaweedfs/weed/sequence" @@ -419,11 +420,13 @@ func TestPickForWrite(t *testing.T) { Rack: "", DataNode: "", } + v := util.GetViper() + v.Set("master.volume_growth.threshold", 0.9) for _, rpStr := range []string{"001", "010", "100"} { rp, _ := super_block.NewReplicaPlacementFromString(rpStr) vl := topo.GetVolumeLayout("test", rp, needle.EMPTY_TTL, types.HardDriveType) volumeGrowOption.ReplicaPlacement = rp - for _, dc := range []string{"", "dc1", "dc2", "dc3"} { + for _, dc := range []string{"", "dc1", "dc2", "dc3", "dc0"} { volumeGrowOption.DataCenter = dc for _, r := range []string{""} { volumeGrowOption.Rack = r @@ -432,8 +435,13 @@ func TestPickForWrite(t *testing.T) { continue } volumeGrowOption.DataNode = dn - fileId, count, _, _, err := topo.PickForWrite(1, volumeGrowOption, vl) - if err != nil { + fileId, count, _, shouldGrow, err := topo.PickForWrite(1, volumeGrowOption, vl) + if dc == "dc0" { + if err == nil || count != 0 || !shouldGrow { + fmt.Println(dc, r, dn, "pick for write should be with error") + t.Fail() + } + } else if err != nil { fmt.Println(dc, r, dn, "pick for write error :", err) t.Fail() } else if count == 0 { @@ -442,6 +450,9 @@ func TestPickForWrite(t *testing.T) { } else if len(fileId) == 0 { fmt.Println(dc, r, dn, "pick for write file id is empty") t.Fail() + } else if shouldGrow { + fmt.Println(dc, r, dn, "pick for write error : not should grow") + t.Fail() } } } |
