youki icon indicating copy to clipboard operation
youki copied to clipboard

Add poststart_fail hook test

Open fspv opened this issue 1 month ago • 2 comments

Description

This implements a test similar to https://github.com/opencontainers/runtime-tools/blob/master/validation/poststart_fail/poststart_fail.go as a part of the https://github.com/youki-dev/youki/issues/361

Type of Change

  • [ ] Bug fix (non-breaking change that fixes an issue)
  • [ ] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update
  • [ ] Refactoring (no functional changes)
  • [ ] Performance improvement
  • [x] Test updates
  • [ ] CI/CD related changes
  • [ ] Other (please describe):

Testing

  • [ ] Added new unit tests
  • [x] Added new integration tests
  • [ ] Ran existing test suite
  • [ ] Tested manually (please provide steps)

Related Issues

https://github.com/youki-dev/youki/issues/361

Additional Context

The test is similar to the happy case test landed in https://github.com/youki-dev/youki/pull/3292 but it focuses on the error handling.

I made it a bit different to the original go test to make sure we also test a couple of more things. I create three hooks, with the second hook failing. We expect that the first two hooks to run and exit with an error. The hook after the failed hook should not run as implied by the lifecycle spec https://github.com/opencontainers/runtime-spec/blob/main/runtime.md#lifecycle.

One assumption I make here is that the hooks are executed in the same order they're defined in a spec, which is not explicitly stated anywhere in the runtime spec but anyway I think it is a relatively safe assumption and it is nice to guarantee this order even if the spec doesn't require it.

Also, this test is affected by the same bug as a happy case scenario https://github.com/opencontainers/runc/issues/4347 so an extra branch has been added to handle the incorrect runc behaviour.

fspv avatar Dec 07 '25 13:12 fspv

Hey @YJDoc2

Can you help me with containerd-integration-tests failure?

It fails on

--- FAIL: TestContainerPids (0.19s)

I can't see how it could be related to the change I made here.

fspv avatar Dec 07 '25 13:12 fspv

As you said, this PR only changes test code, so the containerd-test error is unrelated.

saku3 avatar Dec 07 '25 14:12 saku3

I've addressed the comments, but one of the tests timed out. Pretty sure it is not related to my change, so will be happy if someone can trigger a re-run.

fspv avatar Dec 15 '25 10:12 fspv