From ea7bab07145f984de8b3da2723644e2b8402bc5f Mon Sep 17 00:00:00 2001 From: Kris Hicks Date: Tue, 26 Jan 2021 08:27:14 -0800 Subject: [PATCH] Add e2e test for raw exec --- e2e/isolation/isolation.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/e2e/isolation/isolation.go b/e2e/isolation/isolation.go index b58d5500d..34cfd3c48 100644 --- a/e2e/isolation/isolation.go +++ b/e2e/isolation/isolation.go @@ -65,3 +65,35 @@ func (tc *IsolationTest) TestIsolation_ExecDriver_PIDNamespacing(f *framework.F) require.Contains(t, out, "my pid is 1\n") } + +func (tc *IsolationTest) TestIsolation_RawExecDriver_NoPIDNamespacing(f *framework.F) { + t := f.T() + + clientNodes, err := e2eutil.ListLinuxClientNodes(tc.Nomad()) + require.Nil(t, err) + + if len(clientNodes) == 0 { + t.Skip("no Linux clients") + } + + uuid := uuid.Generate() + jobID := "isolation-pid-namespace-" + uuid[0:8] + file := "isolation/input/echo_pid_raw_exec.nomad" + + allocs := e2eutil.RegisterAndWaitForAllocs(t, tc.Nomad(), file, jobID, "") + require.Equal(t, len(allocs), 1, fmt.Sprintf("failed to register %s", jobID)) + + tc.jobIDs = append(tc.jobIDs, jobID) + + allocID := allocs[0].ID + e2eutil.WaitForAllocStopped(t, tc.Nomad(), allocID) + + out, err := e2eutil.AllocLogs(allocID, e2eutil.LogsStdOut) + require.NoError(t, err, fmt.Sprintf("could not get logs for alloc %s", allocID)) + + var pid uint64 + _, err = fmt.Sscanf(out, "my pid is %d", &pid) + require.NoError(t, err) + + require.Greater(t, pid, uint64(1)) +}