seaweedfs/weed/storage/volume_info_test.go

28 lines
370 B
Go
Raw Normal View History

2015-04-20 17:22:13 +00:00
package storage
2019-04-19 04:43:36 +00:00
import (
"testing"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
2019-04-19 04:43:36 +00:00
)
2015-04-20 17:22:13 +00: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 04:43:36 +00:00
if vis[i].Id != needle.VolumeId(i+1) {
2015-04-20 17:22:13 +00:00
t.Fatal()
}
}
}