示例#1
0
func TestNewVolumeEntryFromRequest(t *testing.T) {

	req := VolCreateRequest{}
	req.Name = "vol1"

	v := NewVolumeEntry(req)
	tests.Assert(t, v.Name == "vol1")
	tests.Assert(t, v.Transport == "tcp")
	tests.Assert(t, v.ReplicaCount == 1)
	tests.Assert(t, len(v.ID) != 0)
	tests.Assert(t, len(v.Bricks) == 0)

}
示例#2
0
func TestNewVolumeEntryFromEmptyRequest(t *testing.T) {

	req := VolCreateRequest{}

	v := NewVolumeEntry(req)
	tests.Assert(t, len(v.Name) == 0)
}
示例#3
0
func TestNewVolumeEntryFromRequestRedundancy(t *testing.T) {

	req := VolCreateRequest{}
	req.RedundancyCount = 2

	v := NewVolumeEntry(req)
	tests.Assert(t, v.RedundancyCount == 2)
}
示例#4
0
func TestNewVolumeEntryFromRequestDisperse(t *testing.T) {

	req := VolCreateRequest{}
	req.DisperseCount = 2

	v := NewVolumeEntry(req)
	tests.Assert(t, v.DisperseCount == 2)
}
示例#5
0
func TestNewVolumeEntryFromRequestTransport(t *testing.T) {

	req := VolCreateRequest{}
	req.Transport = "rdma"

	v := NewVolumeEntry(req)
	tests.Assert(t, v.Transport == "rdma")
}
示例#6
0
func TestNewVolumeEntryFromRequestReplica(t *testing.T) {

	req := VolCreateRequest{}
	req.Name = "vol1"
	req.ReplicaCount = 3

	v := NewVolumeEntry(req)
	tests.Assert(t, v.ReplicaCount == 3)
}
示例#7
0
func TestNewVolumeEntryFromRequestBricks(t *testing.T) {

	req := VolCreateRequest{}
	req.Bricks = []string{"abc", "def"}

	v := NewVolumeEntry(req)
	for _, brick := range req.Bricks {
		tests.Assert(t, find(v.Bricks, brick))
	}
}
示例#8
0
func TestNewVolumeEntry(t *testing.T) {
	v := NewVolinfo()

	tests.Assert(t, v.Options != nil)
	tests.Assert(t, len(v.ID) == 0)
}