aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_info_test.go
blob: 5b1bacb525e254a583a8f5becf88afda5e02e21a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package storage

import (
	"testing"

	"github.com/chrislusf/seaweedfs/weed/storage/needle"
)

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++ {
		if vis[i].Id != needle.VolumeId(i+1) {
			t.Fatal()
		}
	}
}