Add e2e test for raw exec

This commit is contained in:
Kris Hicks 2021-01-26 08:27:14 -08:00 committed by Chris Baker
parent a5298ea4ba
commit 2db8aa2a52
1 changed files with 32 additions and 0 deletions

View File

@ -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))
}