mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 14:43:51 +00:00
virtcontainers: fix unit tests
Use noopAgent in unit tests to add online fake resources. Fix unit tests according with new changes introduced recently. fixes #192 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
bc83bf052d
commit
cde11c36db
@ -1726,7 +1726,7 @@ func TestEnterContainerFailingContNotStarted(t *testing.T) {
|
|||||||
cmd := newBasicTestCmd()
|
cmd := newBasicTestCmd()
|
||||||
|
|
||||||
_, c, _, err = EnterContainer(p.ID(), contID, cmd)
|
_, c, _, err = EnterContainer(p.ID(), contID, cmd)
|
||||||
if c != nil || err == nil {
|
if c == nil || err != nil {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,6 +210,12 @@ func TestContainerAddDriveDir(t *testing.T) {
|
|||||||
id: testPodID,
|
id: testPodID,
|
||||||
storage: fs,
|
storage: fs,
|
||||||
hypervisor: &mockHypervisor{},
|
hypervisor: &mockHypervisor{},
|
||||||
|
agent: &noopAgent{},
|
||||||
|
config: &PodConfig{
|
||||||
|
HypervisorConfig: HypervisorConfig{
|
||||||
|
DisableBlockDeviceUse: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
contID := "100"
|
contID := "100"
|
||||||
@ -258,7 +264,6 @@ func TestContainerAddDriveDir(t *testing.T) {
|
|||||||
if container.state.Fstype == "" || !container.state.HotpluggedDrive {
|
if container.state.Fstype == "" || !container.state.HotpluggedDrive {
|
||||||
t.Fatal()
|
t.Fatal()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckPodRunningEmptyCmdFailure(t *testing.T) {
|
func TestCheckPodRunningEmptyCmdFailure(t *testing.T) {
|
||||||
@ -307,7 +312,10 @@ func TestContainerAddResources(t *testing.T) {
|
|||||||
CPUQuota: 5000,
|
CPUQuota: 5000,
|
||||||
CPUPeriod: 1000,
|
CPUPeriod: 1000,
|
||||||
}
|
}
|
||||||
c.pod = &Pod{hypervisor: &mockHypervisor{}}
|
c.pod = &Pod{
|
||||||
|
hypervisor: &mockHypervisor{},
|
||||||
|
agent: &noopAgent{},
|
||||||
|
}
|
||||||
err = c.addResources()
|
err = c.addResources()
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user