diff --git a/virtcontainers/api_test.go b/virtcontainers/api_test.go index ce4d01fff2..8db38a8e41 100644 --- a/virtcontainers/api_test.go +++ b/virtcontainers/api_test.go @@ -1726,7 +1726,7 @@ func TestEnterContainerFailingContNotStarted(t *testing.T) { cmd := newBasicTestCmd() _, c, _, err = EnterContainer(p.ID(), contID, cmd) - if c != nil || err == nil { + if c == nil || err != nil { t.Fatal() } } diff --git a/virtcontainers/container_test.go b/virtcontainers/container_test.go index 6ad6d9961a..4897e34a38 100644 --- a/virtcontainers/container_test.go +++ b/virtcontainers/container_test.go @@ -210,6 +210,12 @@ func TestContainerAddDriveDir(t *testing.T) { id: testPodID, storage: fs, hypervisor: &mockHypervisor{}, + agent: &noopAgent{}, + config: &PodConfig{ + HypervisorConfig: HypervisorConfig{ + DisableBlockDeviceUse: false, + }, + }, } contID := "100" @@ -258,7 +264,6 @@ func TestContainerAddDriveDir(t *testing.T) { if container.state.Fstype == "" || !container.state.HotpluggedDrive { t.Fatal() } - } func TestCheckPodRunningEmptyCmdFailure(t *testing.T) { @@ -307,7 +312,10 @@ func TestContainerAddResources(t *testing.T) { CPUQuota: 5000, CPUPeriod: 1000, } - c.pod = &Pod{hypervisor: &mockHypervisor{}} + c.pod = &Pod{ + hypervisor: &mockHypervisor{}, + agent: &noopAgent{}, + } err = c.addResources() assert.Nil(err) }