unit-tests: fix unit tests

Fix #50

Fix unit tests

Signed-off-by: Wei Zhang <zhangwei555@huawei.com>
This commit is contained in:
Wei Zhang
2018-07-01 12:00:18 +08:00
committed by z00280905
parent 7f5989f06c
commit 1b062b3db4
5 changed files with 61 additions and 41 deletions

View File

@@ -15,7 +15,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/kata-containers/runtime/virtcontainers/device/config"
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
)
const (
@@ -206,12 +205,12 @@ func testQemuArchBaseAppend(t *testing.T, structure interface{}, expected []govm
devices = qemuArchBase.append9PVolume(devices, s)
case Socket:
devices = qemuArchBase.appendSocket(devices, s)
case drivers.Drive:
case config.BlockDrive:
devices = qemuArchBase.appendBlockDevice(devices, s)
case drivers.VFIODevice:
case config.VFIODrive:
devices = qemuArchBase.appendVFIODevice(devices, s)
case drivers.VhostUserNetDevice:
devices = qemuArchBase.appendVhostUserDevice(devices, &s)
case config.VhostUserDeviceAttrs:
devices = qemuArchBase.appendVhostUserDevice(devices, s)
}
assert.Equal(devices, expected)
@@ -364,7 +363,7 @@ func TestQemuArchBaseAppendBlockDevice(t *testing.T) {
},
}
drive := drivers.Drive{
drive := config.BlockDrive{
File: file,
Format: format,
ID: id,
@@ -388,7 +387,8 @@ func TestQemuArchBaseAppendVhostUserDevice(t *testing.T) {
},
}
vhostUserDevice := drivers.VhostUserNetDevice{
vhostUserDevice := config.VhostUserDeviceAttrs{
Type: config.VhostUserNet,
MacAddress: macAddress,
}
vhostUserDevice.ID = id
@@ -406,7 +406,7 @@ func TestQemuArchBaseAppendVFIODevice(t *testing.T) {
},
}
vfDevice := drivers.VFIODevice{
vfDevice := config.VFIODrive{
BDF: bdf,
}