Skip to content
Closed
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
6 changes: 5 additions & 1 deletion tests/integration/hooks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ function teardown() {
# shellcheck disable=SC2016
update_config '.hooks |= {"'$hook'": [{"path": "/bin/true"}, {"path": "/bin/false"}]}'
runc run "test_hook-$hook"
[[ "$output" != "Hello World" ]]
[ "$status" -ne 0 ]
[[ "$output" != *"Hello World"* ]]
[[ "$output" == *"error running $hook hook #1:"* ]]
# Check the container was never started.
runc delete "test_hook-$hook"
Comment on lines +43 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify here what happens that the container status is not 0 but can be started anyways? I mean clarify in the comment. As it doesn't seem intuitive :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @kolyshkin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I rechecked and this PR does not test the issue it's supposed to test.

IOW, with the terminate code removed, like this:

diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go
index 6a91df01..c6883c56 100644
--- a/libcontainer/container_linux.go
+++ b/libcontainer/container_linux.go
@@ -360,9 +360,6 @@ func (c *Container) start(process *Process) (retErr error) {
                        }
 
                        if err := c.config.Hooks.Run(configs.Poststart, s); err != nil {
-                               if err := ignoreTerminateErrors(parent.terminate()); err != nil {
-                                       logrus.Warn(fmt.Errorf("error running poststart hook: %w", err))
-                               }
                                return err
                        }
                }

It does not fail. I'm not quite sure why, but obviously this PR is useless.

[ "$status" -eq 1 ]
[[ "$output" == *"container does not exist"* ]]
done
}