Merge pull request #5853 from claudiubelu/integration/windows-hostprocess
integration: Adds Windows HostProcess tests
This commit is contained in:
@@ -192,6 +192,17 @@ func PodSandboxConfigWithCleanup(t *testing.T, name, ns string, opts ...PodSandb
|
||||
return sb, sbConfig
|
||||
}
|
||||
|
||||
// Set Windows HostProcess.
|
||||
func WithWindowsHostProcess(p *runtime.PodSandboxConfig) { //nolint:unused
|
||||
if p.Windows == nil {
|
||||
p.Windows = &runtime.WindowsPodSandboxConfig{}
|
||||
}
|
||||
if p.Windows.SecurityContext == nil {
|
||||
p.Windows.SecurityContext = &runtime.WindowsSandboxSecurityContext{}
|
||||
}
|
||||
p.Windows.SecurityContext.HostProcess = true
|
||||
}
|
||||
|
||||
// ContainerOpts to set any specific attribute like labels,
|
||||
// annotations, metadata etc
|
||||
type ContainerOpts func(*runtime.ContainerConfig)
|
||||
@@ -227,6 +238,18 @@ func WithVolumeMount(hostPath, containerPath string) ContainerOpts {
|
||||
}
|
||||
}
|
||||
|
||||
func WithWindowsUsername(username string) ContainerOpts { //nolint:unused
|
||||
return func(c *runtime.ContainerConfig) {
|
||||
if c.Windows == nil {
|
||||
c.Windows = &runtime.WindowsContainerConfig{}
|
||||
}
|
||||
if c.Windows.SecurityContext == nil {
|
||||
c.Windows.SecurityContext = &runtime.WindowsContainerSecurityContext{}
|
||||
}
|
||||
c.Windows.SecurityContext.RunAsUsername = username
|
||||
}
|
||||
}
|
||||
|
||||
// Add container command.
|
||||
func WithCommand(cmd string, args ...string) ContainerOpts {
|
||||
return func(c *runtime.ContainerConfig) {
|
||||
|
Reference in New Issue
Block a user