seaweedfs/weed/storage/volume_info_test.go

28 lines
370 B
Go
Raw Normal View History

2015-04-21 01:22:13 +08:00
package storage
2019-04-19 12:43:36 +08:00
import (
"testing"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
2019-04-19 12:43:36 +08:00
)
2015-04-21 01:22:13 +08:00
func TestSortVolumeInfos(t *testing.T) {
vis := []*VolumeInfo{
&VolumeInfo{
Id: 2,
},
&VolumeInfo{
Id: 1,
},
&VolumeInfo{
Id: 3,
},
}
sortVolumeInfos(vis)
for i := 0; i < len(vis); i++ {
2019-04-19 12:43:36 +08:00
if vis[i].Id != needle.VolumeId(i+1) {
2015-04-21 01:22:13 +08:00
t.Fatal()
}
}
}