mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
virtcontainers: clh: Fix the unit test
This patch fixes the unit tests over clh.go with the updated client code. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
d967d3cb37
commit
bff38e4f4d
@ -134,19 +134,19 @@ func TestCloudHypervisorAddNetCheckNetConfigListValues(t *testing.T) {
|
|||||||
err := clh.addNet(e)
|
err := clh.addNet(e)
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
|
|
||||||
assert.Equal(len(clh.vmconfig.Net), 1)
|
assert.Equal(len(*clh.vmconfig.Net), 1)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
assert.Equal(clh.vmconfig.Net[0].Mac, macTest)
|
assert.Equal(*(*clh.vmconfig.Net)[0].Mac, macTest)
|
||||||
assert.Equal(clh.vmconfig.Net[0].Tap, tapPath)
|
assert.Equal(*(*clh.vmconfig.Net)[0].Tap, tapPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = clh.addNet(e)
|
err = clh.addNet(e)
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
|
|
||||||
assert.Equal(len(clh.vmconfig.Net), 2)
|
assert.Equal(len(*clh.vmconfig.Net), 2)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
assert.Equal(clh.vmconfig.Net[1].Mac, macTest)
|
assert.Equal(*(*clh.vmconfig.Net)[1].Mac, macTest)
|
||||||
assert.Equal(clh.vmconfig.Net[1].Tap, tapPath)
|
assert.Equal(*(*clh.vmconfig.Net)[1].Tap, tapPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ func TestCloudHypervisorAddNetCheckEnpointTypes(t *testing.T) {
|
|||||||
t.Errorf("cloudHypervisor.addNet() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("cloudHypervisor.addNet() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
|
||||||
} else if err == nil {
|
} else if err == nil {
|
||||||
assert.Equal(clh.vmconfig.Net[0].Tap, tapPath)
|
assert.Equal(*(*clh.vmconfig.Net)[0].Tap, tapPath)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -294,8 +294,9 @@ func TestCloudHypervisorResizeMemory(t *testing.T) {
|
|||||||
clh := cloudHypervisor{}
|
clh := cloudHypervisor{}
|
||||||
|
|
||||||
mockClient := &clhClientMock{}
|
mockClient := &clhClientMock{}
|
||||||
mockClient.vmInfo.Config.Memory.Size = int64(utils.MemUnit(clhConfig.MemorySize) * utils.MiB)
|
mockClient.vmInfo.Config = *chclient.NewVmConfig(*chclient.NewKernelConfig(""))
|
||||||
mockClient.vmInfo.Config.Memory.HotplugSize = int64(40 * utils.GiB.ToBytes())
|
mockClient.vmInfo.Config.Memory = chclient.NewMemoryConfig(int64(utils.MemUnit(clhConfig.MemorySize) * utils.MiB))
|
||||||
|
mockClient.vmInfo.Config.Memory.HotplugSize = func(i int64) *int64 { return &i }(int64(40 * utils.GiB.ToBytes()))
|
||||||
|
|
||||||
clh.APIClient = mockClient
|
clh.APIClient = mockClient
|
||||||
clh.config = clhConfig
|
clh.config = clhConfig
|
||||||
|
Loading…
Reference in New Issue
Block a user