Skip to content

Commit

Permalink
virtcontainers: skip cgroup namespace check
Browse files Browse the repository at this point in the history
Old kernels, like 3.x, does not support cgroup namespace. Skip the test that
checks this namespace if its path in /proc doesn't exist.

Depends-on: github.com/kata-containers/tests#1414

fixes kata-containers#228

Signed-off-by: Julio Montes <julio.montes@intel.com>
  • Loading branch information
Julio Montes committed Apr 3, 2019
1 parent 722aa3f commit 62e0341
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions virtcontainers/pkg/nsenter/nsenter_test.go
Expand Up @@ -84,6 +84,12 @@ func TestGetFileFromNSWrongNSPathFailure(t *testing.T) {
func TestGetFileFromNSSuccessful(t *testing.T) {
for nsType := range CloneFlagsTable {
nsFilePath := fmt.Sprintf("/proc/self/ns/%s", string(nsType))
if _, err := os.Stat(nsFilePath); os.IsNotExist(err) {
// some namespaces, like cgroup, are too new for longterm distros with
// old kernels.
t.Logf("Namespace '%s' is not supported in this kernel. Update your kernel to a version >4.0", string(nsType))
continue
}
nsFile, err := getFileFromNS(nsFilePath)
assert.Nil(t, err, "Should have succeeded: %v", err)
assert.NotNil(t, nsFile, "The file handler should not be nil")
Expand Down

0 comments on commit 62e0341

Please sign in to comment.