integration/internal/container: add WithPIDMode option

Some files used aliases, others didn't, and they didn't appear to be
required.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-11 20:35:56 +02:00
parent 917dae58e1
commit 17571ff199
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,7 @@ import (
"gotest.tools/v3/skip"
)
func TestPidHost(t *testing.T) {
func TestPIDModeHost(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, testEnv.IsRemoteDaemon())
@ -23,9 +23,7 @@ func TestPidHost(t *testing.T) {
apiClient := testEnv.APIClient()
ctx := context.Background()
cID := container.Run(ctx, t, apiClient, func(c *container.TestContainerConfig) {
c.HostConfig.PidMode = "host"
})
cID := container.Run(ctx, t, apiClient, container.WithPIDMode("host"))
poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
cPid := container.GetContainerNS(ctx, t, apiClient, cID, "pid")
assert.Assert(t, hostPid == cPid)

View file

@ -273,3 +273,10 @@ func WithSecurityOpt(opt string) func(*TestContainerConfig) {
c.HostConfig.SecurityOpt = append(c.HostConfig.SecurityOpt, opt)
}
}
// WithPIDMode sets the PID-mode for the container.
func WithPIDMode(mode container.PidMode) func(c *TestContainerConfig) {
return func(c *TestContainerConfig) {
c.HostConfig.PidMode = mode
}
}