Test that additional groups set with `--group-add` are kept on exec when the container also has a user set. (regression test for https://github.com/moby/moby/issues/46712)
(t *testing.T)
| 418 | // also has a user set. |
| 419 | // (regression test for https://github.com/moby/moby/issues/46712) |
| 420 | func TestExecWithGroupAdd(t *testing.T) { |
| 421 | skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.") |
| 422 | |
| 423 | ctx := setupTest(t) |
| 424 | apiClient := testEnv.APIClient() |
| 425 | |
| 426 | cID := container.Run(ctx, t, apiClient, container.WithTty(true), container.WithUser("root:root"), container.WithAdditionalGroups("staff", "wheel", "audio", "777"), container.WithCmd("sleep", "5")) |
| 427 | |
| 428 | result, err := container.Exec(ctx, apiClient, cID, []string{"id"}) |
| 429 | assert.NilError(t, err) |
| 430 | |
| 431 | const expected = "uid=0(root) gid=0(root) groups=0(root),10(wheel),29(audio),50(staff),777" |
| 432 | assert.Check(t, is.Equal(strings.TrimSpace(result.Stdout()), expected), "exec command not keeping additional groups w/ user") |
| 433 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…