(t *testing.T, userns bool)
| 126 | } |
| 127 | |
| 128 | func 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 | |
| 150 | func TestEnter(t *testing.T) { |
| 151 | if testing.Short() { |
no test coverage detected
searching dependent graphs…