-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validation: add test for NSProcInPath #628
validation: add test for NSProcInPath #628
Conversation
ab68d5b
to
e450168
Compare
e450168
to
8e46543
Compare
It failed when I tested:
For |
@q384566678 Yeah, I'm aware of both failures. Cgroupns test fails because runc has never supported cgroup namespaces. See the pending PR opencontainers/runc#1184. |
I think so.
I think we can add some explanations to the cgroups to facilitate understanding. |
I initially tried to add the checks in the container process 'runtimetest' by adding annotations prefixed with "runtimetest/". But that proved impractical with TAP outputs because I wanted to have several tests for each namespace. This patch now validates the namespaces outside the container with util.RuntimeOutsideValidate(). Signed-off-by: Alban Crequy <[email protected]>
We need to deal with additional namespace strings, in case of mount & network namespaces, because `MapStrToNamespace()` does not recognize input strings like `mnt` or `net`. Found by @alban. Signed-off-by: Dongsu Park <[email protected]>
`unshare --fork` spawn child processes, which remains even after the test program finished. To be able to kill these processes at once, we should set a process group for the child processes. Signed-off-by: Dongsu Park <[email protected]>
Since it takes some time until unshare can switch to a new namespace, we need a sync mechanism for the NSProcInPath. Let's use a generic sync mechanism by using select & time ticker instead of pure sleep. Signed-off-by: Dongsu Park <[email protected]>
Like other tests, `testNamespacePath` should also print out details about the failed tests, based on specError. Also make `waitForState(doCheckNamespacePath)` return a correct error coming from `checkNamespacePath`, not from `waitForState`. Signed-off-by: Dongsu Park <[email protected]>
Now that a new helper `NewRFCError()` is available, we should make use of the helper instead of `specerror.NewError()`. This way, we can avoid doing multiple casts to be able to get rfcError. Signed-off-by: Dongsu Park <[email protected]>
8e46543
to
8043e83
Compare
@q384566678 |
8043e83
to
742644a
Compare
@q384566678 |
a61d4e2
to
ad0e97e
Compare
Cgroup namespaces test fails because runc does not support it yet. User namespaces test fails because of many unexpected issues when running unshare with runc, etc. We are going to revisit these tests later, to figure out how to deal with them. Let's exclude these two types of namespaces for now. Signed-off-by: Dongsu Park <[email protected]>
This PR validates
NSProcInPath
, i.e.The runtime MUST place the container process in the namespace associated with that path
. It checks that Linux namespaces are created with a given path by making use ofutil.RuntimeOutsideValidate()
.Since the previous version of PR, we had to fix the following things:
setpgid()
.This PR replaces #613.
See also #572.