diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-10-03 20:43:18 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-10-03 20:44:20 -0700 |
commit | 3f46f2e5017106d1569f759b8d19aee6e9827c58 (patch) | |
tree | 8dfdc15d3af75e808944099ca2b0b85ea6ee12de /runsc/test/testutil/testutil.go | |
parent | beac59b37a8b0ea834904870e5c236d2627947a2 (diff) |
Fix sandbox chroot
Sandbox was setting chroot, but was not chaging the working
dir. Added test to ensure this doesn't happen in the future.
PiperOrigin-RevId: 215676270
Change-Id: I14352d3de64a4dcb90e50948119dc8328c9c15e1
Diffstat (limited to 'runsc/test/testutil/testutil.go')
-rw-r--r-- | runsc/test/testutil/testutil.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runsc/test/testutil/testutil.go b/runsc/test/testutil/testutil.go index cdc7f78c3..b4664995c 100644 --- a/runsc/test/testutil/testutil.go +++ b/runsc/test/testutil/testutil.go @@ -238,7 +238,7 @@ func WaitForHTTP(port int, timeout time.Duration) error { } // RunAsRoot ensures the test runs with CAP_SYS_ADMIN and CAP_SYS_CHROOT. If -// need it will create a new user namespace and reexecute the test as root +// needed it will create a new user namespace and re-execute the test as root // inside of the namespace. This functionr returns when it's running as root. If // it needs to create another process, it will exit from there and not return. func RunAsRoot() { @@ -246,6 +246,8 @@ func RunAsRoot() { return } + fmt.Println("*** Re-running test as root in new user namespace ***") + // Current process doesn't have CAP_SYS_ADMIN, create user namespace and run // as root inside that namespace to get it. runtime.LockOSThread() |