MCPcopy
hub / github.com/opencontainers/runc / testRlimit

Function testRlimit

libcontainer/integration/exec_test.go:128–148  ·  view source on GitHub ↗
(t *testing.T, userns bool)

Source from the content-addressed store, hash-verified

126}
127
128func testRlimit(t *testing.T, userns bool) {
129 if testing.Short() {
130 return
131 }
132
133 config := newTemplateConfig(t, &tParam{userns: userns})
134
135 // Ensure limit is lower than what the config requests to test that in a user namespace
136 // the Setrlimit call happens early enough that we still have permissions to raise the limit.
137 // Do not change the Cur value to be equal to the Max value, please see:
138 // https://github.com/opencontainers/runc/pull/4265#discussion_r1589666444
139 ok(t, unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{
140 Max: 1024,
141 Cur: 512,
142 }))
143
144 out := runContainerOk(t, config, "/bin/sh", "-c", "ulimit -n")
145 if limit := strings.TrimSpace(out.Stdout.String()); limit != "1025" {
146 t.Fatalf("expected rlimit to be 1025, got %s", limit)
147 }
148}
149
150func TestEnter(t *testing.T) {
151 if testing.Short() {

Callers 2

TestRlimitFunction · 0.85
TestUsernsRlimitFunction · 0.85

Calls 4

newTemplateConfigFunction · 0.85
okFunction · 0.85
runContainerOkFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…