diff --git a/device_test.go b/device_test.go index 4c4312dc..f41593f3 100644 --- a/device_test.go +++ b/device_test.go @@ -322,10 +322,19 @@ func TestAttachBlockDevice(t *testing.T) { fs := &filesystem{} hypervisor := &mockHypervisor{} + hConfig := HypervisorConfig{ + BlockDeviceDriver: VirtioBlock, + } + + config := &PodConfig{ + HypervisorConfig: hConfig, + } + pod := &Pod{ id: testPodID, storage: fs, hypervisor: hypervisor, + config: config, } contID := "100" @@ -376,4 +385,18 @@ func TestAttachBlockDevice(t *testing.T) { err = device.detach(hypervisor) assert.Nil(t, err) + + container.pod.config.HypervisorConfig.BlockDeviceDriver = VirtioSCSI + err = device.attach(hypervisor, &container) + assert.Nil(t, err) + + err = device.detach(hypervisor) + assert.Nil(t, err) + + container.state.State = StateReady + err = device.attach(hypervisor, &container) + assert.Nil(t, err) + + err = device.detach(hypervisor) + assert.Nil(t, err) }