Exemplo n.º 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)

}
Exemplo n.º 2
0
func TestNewVolumeEntryFromEmptyRequest(t *testing.T) {

	req := VolCreateRequest{}

	v := NewVolumeEntry(req)
	tests.Assert(t, len(v.Name) == 0)
}
Exemplo n.º 3
0
func TestNewVolumeEntryFromRequestRedundancy(t *testing.T) {

	req := VolCreateRequest{}
	req.RedundancyCount = 2

	v := NewVolumeEntry(req)
	tests.Assert(t, v.RedundancyCount == 2)
}
Exemplo n.º 4
0
func TestNewVolumeEntryFromRequestDisperse(t *testing.T) {

	req := VolCreateRequest{}
	req.DisperseCount = 2

	v := NewVolumeEntry(req)
	tests.Assert(t, v.DisperseCount == 2)
}
Exemplo n.º 5
0
func TestNewVolumeEntryFromRequestTransport(t *testing.T) {

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

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

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

	v := NewVolumeEntry(req)
	tests.Assert(t, v.ReplicaCount == 3)
}
Exemplo n.º 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))
	}
}
Exemplo n.º 8
0
func TestNewVolumeEntry(t *testing.T) {
	v := NewVolinfo()

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