Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions libcontainer/integration/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ func TestPassExtraFiles(t *testing.T) {
ExtraFiles: []*os.File{pipein1, pipein2},
Stdin: nil,
Stdout: &stdout,
Stderr: new(strings.Builder),
Init: true,
}
err = container.Run(&process)
Expand Down Expand Up @@ -1074,11 +1075,14 @@ func TestHook(t *testing.T) {
container, err := newContainer(t, config)
ok(t, err)

// e.g: 'ls /prestart ...'
var cmd strings.Builder
cmd.WriteString("ls ")
for _, hook := range hookFiles {
cmd.WriteString("/" + hook + " ")
// The poststart hook is racing with this ls command (run as the
// container init), so we don't check that hook worked here yet.
if hook != "poststart" {
cmd.WriteString("/" + hook + " ")
}
}

var stdout strings.Builder
Expand All @@ -1097,6 +1101,13 @@ func TestHook(t *testing.T) {
// Wait for process
waitProcess(&pconfig, t)

// Check that poststart hook worked.
f, err = os.Open(config.Rootfs + "/poststart")
if err != nil {
t.Fatalf("poststart hook failed: %s", err)
}
f.Close()

if err := container.Destroy(); err != nil {
t.Fatalf("container destroy %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions libcontainer/integration/execin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func TestExecinPassExtraFiles(t *testing.T) {
ExtraFiles: []*os.File{pipein1, pipein2},
Stdin: nil,
Stdout: &stdout,
Stderr: new(strings.Builder),
}
err = container.Run(inprocess)
ok(t, err)
Expand Down
Loading