mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-02 13:44:33 +00:00
gpu: Update unit tests
Some tests are now failing due to the changes how PCIe is handled. Update the test accordingly. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
72f2cb84e6
commit
8330fb8ee7
@ -20,7 +20,7 @@ func TestGetVFIODetails(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data := []testData{
|
data := []testData{
|
||||||
{"0000:02:10.0", "02:10.0"},
|
{"0000:02:10.0", "0000:02:10.0"},
|
||||||
{"0000:0210.0", ""},
|
{"0000:0210.0", ""},
|
||||||
{"f79944e4-5a3d-11e8-99ce-", ""},
|
{"f79944e4-5a3d-11e8-99ce-", ""},
|
||||||
{"f79944e4-5a3d-11e8-99ce", ""},
|
{"f79944e4-5a3d-11e8-99ce", ""},
|
||||||
|
@ -86,8 +86,8 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (testConfig testRuntime
|
|||||||
blockDeviceAIO := "io_uring"
|
blockDeviceAIO := "io_uring"
|
||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
hotPlugVFIO = config.BridgePort
|
hotPlugVFIO = config.NoPort
|
||||||
coldPlugVFIO = config.RootPort
|
coldPlugVFIO = config.BridgePort
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
||||||
@ -612,7 +612,7 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
disableBlock := true
|
disableBlock := true
|
||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
coldPlugVFIO = config.RootPort
|
coldPlugVFIO = config.BridgePort
|
||||||
orgVHostVSockDevicePath := utils.VHostVSockDevicePath
|
orgVHostVSockDevicePath := utils.VHostVSockDevicePath
|
||||||
blockDeviceAIO := "io_uring"
|
blockDeviceAIO := "io_uring"
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -660,8 +660,8 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
ocispec.Annotations[vcAnnotations.GuestHookPath] = "/usr/bin/"
|
ocispec.Annotations[vcAnnotations.GuestHookPath] = "/usr/bin/"
|
||||||
ocispec.Annotations[vcAnnotations.DisableImageNvdimm] = "true"
|
ocispec.Annotations[vcAnnotations.DisableImageNvdimm] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus] = "true"
|
ocispec.Annotations[vcAnnotations.HotplugVFIOOnRootBus] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.ColdPlugVFIO] = string(config.InvalidPort)
|
ocispec.Annotations[vcAnnotations.ColdPlugVFIO] = config.BridgePort
|
||||||
ocispec.Annotations[vcAnnotations.HotPlugVFIO] = string(config.RootPort)
|
ocispec.Annotations[vcAnnotations.HotPlugVFIO] = config.NoPort
|
||||||
ocispec.Annotations[vcAnnotations.IOMMUPlatform] = "true"
|
ocispec.Annotations[vcAnnotations.IOMMUPlatform] = "true"
|
||||||
ocispec.Annotations[vcAnnotations.SGXEPC] = "64Mi"
|
ocispec.Annotations[vcAnnotations.SGXEPC] = "64Mi"
|
||||||
ocispec.Annotations[vcAnnotations.UseLegacySerial] = "true"
|
ocispec.Annotations[vcAnnotations.UseLegacySerial] = "true"
|
||||||
@ -669,7 +669,9 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
ocispec.Annotations[vcAnnotations.RxRateLimiterMaxRate] = "10000000"
|
ocispec.Annotations[vcAnnotations.RxRateLimiterMaxRate] = "10000000"
|
||||||
ocispec.Annotations[vcAnnotations.TxRateLimiterMaxRate] = "10000000"
|
ocispec.Annotations[vcAnnotations.TxRateLimiterMaxRate] = "10000000"
|
||||||
|
|
||||||
addAnnotations(ocispec, &sbConfig, runtimeConfig)
|
err := addAnnotations(ocispec, &sbConfig, runtimeConfig)
|
||||||
|
assert.NoError(err)
|
||||||
|
|
||||||
assert.Equal(sbConfig.HypervisorConfig.NumVCPUs, uint32(1))
|
assert.Equal(sbConfig.HypervisorConfig.NumVCPUs, uint32(1))
|
||||||
assert.Equal(sbConfig.HypervisorConfig.DefaultMaxVCPUs, uint32(1))
|
assert.Equal(sbConfig.HypervisorConfig.DefaultMaxVCPUs, uint32(1))
|
||||||
assert.Equal(sbConfig.HypervisorConfig.MemorySize, uint32(1024))
|
assert.Equal(sbConfig.HypervisorConfig.MemorySize, uint32(1024))
|
||||||
@ -699,8 +701,8 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
assert.Equal(sbConfig.HypervisorConfig.GuestHookPath, "/usr/bin/")
|
assert.Equal(sbConfig.HypervisorConfig.GuestHookPath, "/usr/bin/")
|
||||||
assert.Equal(sbConfig.HypervisorConfig.DisableImageNvdimm, true)
|
assert.Equal(sbConfig.HypervisorConfig.DisableImageNvdimm, true)
|
||||||
assert.Equal(sbConfig.HypervisorConfig.HotplugVFIOOnRootBus, true)
|
assert.Equal(sbConfig.HypervisorConfig.HotplugVFIOOnRootBus, true)
|
||||||
assert.Equal(sbConfig.HypervisorConfig.ColdPlugVFIO, config.InvalidPort)
|
assert.Equal(string(sbConfig.HypervisorConfig.ColdPlugVFIO), string(config.BridgePort))
|
||||||
assert.Equal(sbConfig.HypervisorConfig.HotPlugVFIO, config.RootPort)
|
assert.Equal(string(sbConfig.HypervisorConfig.HotPlugVFIO), string(config.NoPort))
|
||||||
assert.Equal(sbConfig.HypervisorConfig.IOMMUPlatform, true)
|
assert.Equal(sbConfig.HypervisorConfig.IOMMUPlatform, true)
|
||||||
assert.Equal(sbConfig.HypervisorConfig.SGXEPCSize, int64(67108864))
|
assert.Equal(sbConfig.HypervisorConfig.SGXEPCSize, int64(67108864))
|
||||||
assert.Equal(sbConfig.HypervisorConfig.LegacySerial, true)
|
assert.Equal(sbConfig.HypervisorConfig.LegacySerial, true)
|
||||||
@ -709,7 +711,7 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
|||||||
|
|
||||||
// In case an absurd large value is provided, the config value if not over-ridden
|
// In case an absurd large value is provided, the config value if not over-ridden
|
||||||
ocispec.Annotations[vcAnnotations.DefaultVCPUs] = "655536"
|
ocispec.Annotations[vcAnnotations.DefaultVCPUs] = "655536"
|
||||||
err := addAnnotations(ocispec, &sbConfig, runtimeConfig)
|
err = addAnnotations(ocispec, &sbConfig, runtimeConfig)
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
|
|
||||||
ocispec.Annotations[vcAnnotations.DefaultVCPUs] = "-1"
|
ocispec.Annotations[vcAnnotations.DefaultVCPUs] = "-1"
|
||||||
|
Loading…
Reference in New Issue
Block a user