Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
test: fix unit test nil pointer.
Browse files Browse the repository at this point in the history
Add filesystem to qemu object.
Fix mock_hypervisor

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
  • Loading branch information
jcvenegas committed Oct 2, 2018
1 parent 4697cf3 commit 1f5792e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions virtcontainers/mock_hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func (m *mockHypervisor) hotplugAddDevice(devInfo interface{}, devType deviceTyp
switch devType {
case cpuDev:
return m.vCPUs, nil
case memoryDev:
memdev := devInfo.(*memoryDevice)
return memdev.sizeMB, nil
}
return nil, nil
}
Expand Down
8 changes: 6 additions & 2 deletions virtcontainers/qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ func TestHotplugRemoveMemory(t *testing.T) {
assert := assert.New(t)

qemuConfig := newQemuConfig()
fs := &filesystem{}
q := &qemu{
config: qemuConfig,
config: qemuConfig,
storage: fs,
}

_, err := q.hotplugRemoveDevice(&memoryDevice{0, 128}, memoryDev)
Expand All @@ -360,8 +362,10 @@ func TestHotplugUnsupportedDeviceType(t *testing.T) {
assert := assert.New(t)

qemuConfig := newQemuConfig()
fs := &filesystem{}
q := &qemu{
config: qemuConfig,
config: qemuConfig,
storage: fs,
}

_, err := q.hotplugAddDevice(&memoryDevice{0, 128}, fsDev)
Expand Down

0 comments on commit 1f5792e

Please sign in to comment.