runtimetest: fix root readonly check#599
Conversation
Checking the spec again, it doesn't actually say anything about how the runtime should handle the if spec.Root.Readonly {
err := testWriteAccess("/")
if err == nil {
return specerror.NewError(specerror.RootReadonlyImplement, fmt.Errorf("rootfs must be readonly"), rspec.Version)
} else {
err := testWriteAccess("/")
if err != nil {
// print a Skip-level warning, which may depend on #594 or other *tap.T passing
}
}That way we don't have to have an opinion on unspecified implementation details (perhaps the runtime doesn't bother with a |
913f12d to
c08563d
Compare
|
@wking what about this updated patch? I just skip the test on userns if I don't think I need to use |
I agree that the unmapped user-namespace situation should not be a spec violation. But I don't see a need for special handling there, because I don't see spec grounds for this error at all. Do you?
I don't think we can use OPTIONAL, or even MAY, unless we're quoting spec wording, and the spec has nothing in that line for unset/false if spec.Root.Readonly {
// what's in master now
} // no need to check the else caseBut I also think that users may find this surprising, and a TAP skip or stderr log are places where we can warn the user "hey, you might have expected setting |
The rootfs might not be readable despite spec.Root.Readonly being false and that's not a spec violation. Example: the rootfs belong to an unmapped uid. This test is useful for validation/root_readonly_true.go Delete validation/root_readonly_false.go since that's not a spec violation. Signed-off-by: Alban Crequy <alban@kinvolk.io>
c08563d to
9e919c6
Compare
No, I don't.
Ok, I updated the patch that way. I also deleted validation/root_readonly_false.go since that would not test anything.
That would be good indeed. I didn't do that in this PR because that would need more changes for the TAP skip. |
Instead of trying to write a file on the rootfs, check the "ro"
per-mount option on the root mountpoint. The rootfs might not be
readable despite spec.Root.Readonly being false. Example: the rootfs
belong to an unmapped uid.
Signed-off-by: Alban Crequy alban@kinvolk.io