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 <alban@kinvolk.io>
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 <dongsu@kinvolk.io>
`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 <dongsu@kinvolk.io>
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 <dongsu@kinvolk.io>
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 <dongsu@kinvolk.io>
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 <dongsu@kinvolk.io>
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 <dongsu@kinvolk.io>
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.