Skip user namespace tests in kernels which have it disabled
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
ce57d6d619
commit
efcec3674a
@ -987,7 +987,20 @@ func TestUserNamespaces(t *testing.T) {
|
|||||||
t.Run("ReadonlyRootFS", func(t *testing.T) { testUserNamespaces(t, true) })
|
t.Run("ReadonlyRootFS", func(t *testing.T) { testUserNamespaces(t, true) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkUserNS(t *testing.T) {
|
||||||
|
cmd := exec.Command("true")
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
Cloneflags: syscall.CLONE_NEWUSER,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
t.Skip("User namespaces are unavailable")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testUserNamespaces(t *testing.T, readonlyRootFS bool) {
|
func testUserNamespaces(t *testing.T, readonlyRootFS bool) {
|
||||||
|
checkUserNS(t)
|
||||||
|
|
||||||
client, err := newClient(t, address)
|
client, err := newClient(t, address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user