From e58557bbabfd983f83468cb038bf17afac2db7ab Mon Sep 17 00:00:00 2001 From: Wei Zhang Date: Mon, 7 Jan 2019 22:17:22 +0800 Subject: [PATCH] persist: fix test Fix failing unit test Signed-off-by: Wei Zhang --- virtcontainers/container_test.go | 5 +++++ virtcontainers/device/drivers/block.go | 2 +- virtcontainers/device/drivers/generic.go | 2 +- virtcontainers/device/drivers/vfio.go | 2 +- virtcontainers/device/drivers/vhost_user_blk.go | 2 +- virtcontainers/device/drivers/vhost_user_net.go | 2 +- virtcontainers/device/drivers/vhost_user_scsi.go | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/virtcontainers/container_test.go b/virtcontainers/container_test.go index e9bb57beaf..de862ec8e2 100644 --- a/virtcontainers/container_test.go +++ b/virtcontainers/container_test.go @@ -20,6 +20,7 @@ import ( "github.com/kata-containers/runtime/virtcontainers/device/config" "github.com/kata-containers/runtime/virtcontainers/device/drivers" "github.com/kata-containers/runtime/virtcontainers/device/manager" + "github.com/kata-containers/runtime/virtcontainers/persist" "github.com/stretchr/testify/assert" ) @@ -225,6 +226,10 @@ func TestContainerAddDriveDir(t *testing.T) { }, } + if sandbox.store = persist.GetDriver("fs"); sandbox.store == nil { + t.Fatalf("failed to get fs persist driver") + } + contID := "100" container := Container{ sandbox: sandbox, diff --git a/virtcontainers/device/drivers/block.go b/virtcontainers/device/drivers/block.go index d45782fb8c..0272121d59 100644 --- a/virtcontainers/device/drivers/block.go +++ b/virtcontainers/device/drivers/block.go @@ -143,7 +143,7 @@ func (device *BlockDevice) GetDeviceInfo() interface{} { return device.BlockDrive } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *BlockDevice) Dump() persistapi.DeviceState { ds := device.GenericDevice.Dump() ds.Type = string(device.DeviceType()) diff --git a/virtcontainers/device/drivers/generic.go b/virtcontainers/device/drivers/generic.go index be700fbc75..56768c0aff 100644 --- a/virtcontainers/device/drivers/generic.go +++ b/virtcontainers/device/drivers/generic.go @@ -129,7 +129,7 @@ func (device *GenericDevice) bumpAttachCount(attach bool) (skip bool, err error) } } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *GenericDevice) Dump() persistapi.DeviceState { info := device.DeviceInfo return persistapi.DeviceState{ diff --git a/virtcontainers/device/drivers/vfio.go b/virtcontainers/device/drivers/vfio.go index 96af2bfa4c..e422601572 100644 --- a/virtcontainers/device/drivers/vfio.go +++ b/virtcontainers/device/drivers/vfio.go @@ -130,7 +130,7 @@ func (device *VFIODevice) GetDeviceInfo() interface{} { return device.VfioDevs } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *VFIODevice) Dump() persistapi.DeviceState { ds := device.GenericDevice.Dump() ds.Type = string(device.DeviceType()) diff --git a/virtcontainers/device/drivers/vhost_user_blk.go b/virtcontainers/device/drivers/vhost_user_blk.go index 87eb40d61e..be6df8c8a9 100644 --- a/virtcontainers/device/drivers/vhost_user_blk.go +++ b/virtcontainers/device/drivers/vhost_user_blk.go @@ -80,7 +80,7 @@ func (device *VhostUserBlkDevice) GetDeviceInfo() interface{} { return &device.VhostUserDeviceAttrs } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *VhostUserBlkDevice) Dump() persistapi.DeviceState { ds := device.GenericDevice.Dump() ds.Type = string(device.DeviceType()) diff --git a/virtcontainers/device/drivers/vhost_user_net.go b/virtcontainers/device/drivers/vhost_user_net.go index 08dca9269e..6c9a86ebce 100644 --- a/virtcontainers/device/drivers/vhost_user_net.go +++ b/virtcontainers/device/drivers/vhost_user_net.go @@ -80,7 +80,7 @@ func (device *VhostUserNetDevice) GetDeviceInfo() interface{} { return &device.VhostUserDeviceAttrs } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *VhostUserNetDevice) Dump() persistapi.DeviceState { ds := device.GenericDevice.Dump() ds.Type = string(device.DeviceType()) diff --git a/virtcontainers/device/drivers/vhost_user_scsi.go b/virtcontainers/device/drivers/vhost_user_scsi.go index 0622a49148..dd5f07f5ab 100644 --- a/virtcontainers/device/drivers/vhost_user_scsi.go +++ b/virtcontainers/device/drivers/vhost_user_scsi.go @@ -79,7 +79,7 @@ func (device *VhostUserSCSIDevice) GetDeviceInfo() interface{} { return &device.VhostUserDeviceAttrs } -// Persist convert and return data in persist format +// Dump convert and return data in persist format func (device *VhostUserSCSIDevice) Dump() persistapi.DeviceState { ds := device.GenericDevice.Dump() ds.Type = string(device.DeviceType())