(t *testing.T)
| 383 | } |
| 384 | |
| 385 | func TestAdditionalGroups(t *testing.T) { |
| 386 | if testing.Short() { |
| 387 | return |
| 388 | } |
| 389 | |
| 390 | config := newTemplateConfig(t, nil) |
| 391 | container, err := newContainer(t, config) |
| 392 | ok(t, err) |
| 393 | defer destroyContainer(container) |
| 394 | |
| 395 | var stdout strings.Builder |
| 396 | pconfig := libcontainer.Process{ |
| 397 | Cwd: "/", |
| 398 | Args: []string{"sh", "-c", "id", "-Gn"}, |
| 399 | Env: standardEnvironment, |
| 400 | Stdin: nil, |
| 401 | Stdout: &stdout, |
| 402 | Stderr: new(strings.Builder), |
| 403 | AdditionalGroups: []int{3333, 99999}, |
| 404 | Init: true, |
| 405 | } |
| 406 | err = container.Run(&pconfig) |
| 407 | ok(t, err) |
| 408 | |
| 409 | // Wait for process |
| 410 | waitProcess(&pconfig, t) |
| 411 | |
| 412 | outputGroups := stdout.String() |
| 413 | |
| 414 | // Check that the groups output has the groups that we specified. |
| 415 | for _, gid := range pconfig.AdditionalGroups { |
| 416 | if !strings.Contains(outputGroups, strconv.Itoa(gid)) { |
| 417 | t.Errorf("Listed groups do not contain gid %d as expected: %v", gid, outputGroups) |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | func TestFreeze(t *testing.T) { |
| 423 | for _, systemd := range []bool{true, false} { |
nothing calls this directly
no test coverage detected
searching dependent graphs…