You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
368 B

6 years ago
6 years ago
6 years ago
  1. package storage
  2. import (
  3. "testing"
  4. "github.com/joeslay/seaweedfs/weed/storage/needle"
  5. )
  6. func TestSortVolumeInfos(t *testing.T) {
  7. vis := []*VolumeInfo{
  8. &VolumeInfo{
  9. Id: 2,
  10. },
  11. &VolumeInfo{
  12. Id: 1,
  13. },
  14. &VolumeInfo{
  15. Id: 3,
  16. },
  17. }
  18. sortVolumeInfos(vis)
  19. for i := 0; i < len(vis); i++ {
  20. if vis[i].Id != needle.VolumeId(i+1) {
  21. t.Fatal()
  22. }
  23. }
  24. }