New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for cap-add/cap-drop #555
Conversation
Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## main #555 +/- ##
==========================================
+ Coverage 69.01% 69.04% +0.02%
==========================================
Files 22 22
Lines 2172 2174 +2
==========================================
+ Hits 1499 1501 +2
Misses 535 535
Partials 138 138
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, although I encourage you to add a test :)
Take this as an example:
testcontainers-go/docker_test.go
Lines 2131 to 2177 in cb9d7c8
func TestDockerContainerResources(t *testing.T) { | |
if providerType == ProviderPodman { | |
t.Skip("Rootless Podman does not support setting rlimit") | |
} | |
ctx := context.Background() | |
expected := []*units.Ulimit{ | |
{ | |
Name: "memlock", | |
Hard: -1, | |
Soft: -1, | |
}, | |
{ | |
Name: "nofile", | |
Hard: 65536, | |
Soft: 65536, | |
}, | |
} | |
nginxC, err := GenericContainer(ctx, GenericContainerRequest{ | |
ProviderType: providerType, | |
ContainerRequest: ContainerRequest{ | |
Image: nginxAlpineImage, | |
ExposedPorts: []string{nginxDefaultPort}, | |
WaitingFor: wait.ForListeningPort(nginxDefaultPort), | |
Resources: container.Resources{ | |
Ulimits: expected, | |
}, | |
}, | |
Started: true, | |
}) | |
require.NoError(t, err) | |
terminateContainerOnEnd(t, ctx, nginxC) | |
c, err := client.NewClientWithOpts(client.FromEnv) | |
require.NoError(t, err) | |
c.NegotiateAPIVersion(ctx) | |
containerID := nginxC.GetContainerID() | |
resp, err := c.ContainerInspect(ctx, containerID) | |
require.NoError(t, err) | |
assert.Equal(t, expected, resp.HostConfig.Ulimits) | |
} |
@mdelapenya added test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks taking the time to contribute this ❤️
LGTM!
* main: Add system requirements parent docs page for podman and colima (#562) Support for cap-add/cap-drop (#555) fix container NetworkMode usage (#560) chore: use hashed versions of test-summary action (#556) chore: use container.State() function in tests (#543) Log docker server info (#548) docs: add docs regarding Colima usage (#547) chore: add emoji to breaking changes in release drafter (#542) chore: add CONTRIBUTING file (#539) issue #537 Rename the wait/multi.go file to wait/all.go (#541) docs: add a basic layout for wait strategies in docs (#536) docs: improve consistency and fix typos (#534) chore: do not skip test (#528) chore: include test flakiness in the release drafter (#535) chore: retire old versions of Go (#530)
context from slack
adds cap-add/cap-drop to container request and passes to docker host config