CRI integration test for Windows Device mounts

This test takes advantage of the fact that when you tell Windows to
mount the GUID_DEVINTERFACE_DISPLAY_ADAPTER class, it will also mount
the host's device store into the container, even if there is no real GPU
on the host.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
This commit is contained in:
Paul "TBBle" Hampson
2022-03-03 23:44:46 +11:00
parent dc745fc1e5
commit 6a25be94e9
2 changed files with 99 additions and 0 deletions

View File

@@ -297,6 +297,15 @@ func WithSupplementalGroups(gids []int64) ContainerOpts { //nolint:unused
}
}
// WithDevice adds a device mount.
func WithDevice(containerPath, hostPath, permissions string) ContainerOpts { //nolint:unused
return func(c *runtime.ContainerConfig) {
c.Devices = append(c.Devices, &runtime.Device{
ContainerPath: containerPath, HostPath: hostPath, Permissions: permissions,
})
}
}
// ContainerConfig creates a container config given a name and image name
// and additional container config options
func ContainerConfig(name, image string, opts ...ContainerOpts) *runtime.ContainerConfig {