Running the validation/hooks/hooks.t tests should pass, but they always fail.
For example, using runc:
RUNTIME=runc ./validation/hooks/hooks.t
TAP version 13
---
{
"error": "Hooks MUST be called in the listed order\nRefer to: https://github.com/opencontainers/runtime-spec/blob/v1.1.0/config.md#posix-platform-hooks\nThe runtime MUST run the user-specified program, as specified by `process`\nRefer to: https://github.com/opencontainers/runtime-spec/blob/v1.1.0/runtime.md#lifecycle"
}
...
1..0
Seems to be two issues here:
- The bundle directory (where the output file is stored) is deleted (in
RuntimeLifecycleValidate) before the output file is read for comparison:
|
err := util.RuntimeLifecycleValidate(config) |
|
outputData, _ := os.ReadFile(output) |
Because of this:
- The content of
outputData is always empty.
- We don't see the 'file not found' error from
os.ReadFile because it's ignored.
- Even if
outputData was populated per the specified hooks, the comparison of its content will always fail:
|
if err == nil && string(outputData) != "pre-start1 called\npre-start2 called\npost-start1\npost-start2\npost-stop1\npost-stop2\n" { |
- Actual content:
pre-start1 called\npre-start2 called\npost-start1 called\npost-start2 called\npost-stop1 called\npost-stop2 called\n
- Asserted content:
pre-start1 called\npre-start2 called\npost-start1\npost-start2\npost-stop1\npost-stop2\n
- Note the lack of
called postfix for post-startx and post-stopx hooks.
Running the
validation/hooks/hooks.ttests should pass, but they always fail.For example, using
runc:Seems to be two issues here:
RuntimeLifecycleValidate) before the output file is read for comparison:runtime-tools/validation/hooks/hooks.go
Lines 77 to 78 in f7e3563
outputDatais always empty.os.ReadFilebecause it's ignored.outputDatawas populated per the specified hooks, the comparison of its content will always fail:runtime-tools/validation/hooks/hooks.go
Line 79 in f7e3563
pre-start1 called\npre-start2 called\npost-start1 called\npost-start2 called\npost-stop1 called\npost-stop2 called\npre-start1 called\npre-start2 called\npost-start1\npost-start2\npost-stop1\npost-stop2\ncalledpostfix forpost-startxandpost-stopxhooks.