container/path: check create and mountinfo helpers
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m11s
Test / Hakurei (push) Successful in 3m7s
Test / Hpkg (push) Successful in 4m4s
Test / Sandbox (race detector) (push) Successful in 4m28s
Test / Hakurei (race detector) (push) Successful in 5m3s
Test / Flake checks (push) Successful in 1m25s

These can quite easily be checked within the framework. The scanner fault injection might require updating at some point if the implementation changes.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-08-18 21:30:28 +09:00
parent 3c9e547c4a
commit f52d2c7db6
2 changed files with 183 additions and 6 deletions

View File

@@ -111,18 +111,15 @@ func createFile(name string, perm, pperm os.FileMode, content []byte) error {
}
if content != nil {
_, err = f.Write(content)
if err != nil {
err = wrapErrSelf(err)
}
}
return errors.Join(f.Close(), err)
return errors.Join(f.Close(), wrapErrSelf(err))
}
func ensureFile(name string, perm, pperm os.FileMode) error {
fi, err := os.Stat(name)
if err != nil {
if !os.IsNotExist(err) {
return err
return wrapErrSelf(err)
}
return createFile(name, perm, pperm, nil)
}