Skip to content

Commit

Permalink
func: Add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanadelacuesta committed May 8, 2024
1 parent 282a661 commit c5cb91a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/20500.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
client: get rid of old exec allocs before starting new ones, to avoid accidentally leaving running allocs in case of an error
```
14 changes: 8 additions & 6 deletions drivers/shared/executor/executor_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,12 @@ func TestExecCommand_getCgroupOr_v1_relative(t *testing.T) {
must.Eq(t, result2, "/sys/fs/cgroup/cpuset/custom/path")
}

func createCGroup(fullpath string) error {
return os.MkdirAll(fullpath, 0755)
func createCGroup(fullpath string) (cgroupslib.Interface, error) {
if err := os.MkdirAll(fullpath, 0755); err != nil {
return nil, err
}

return cgroupslib.OpenPath(fullpath), nil
}

func TestExecutor_CleanOldProcessesInCGroup(t *testing.T) {
Expand All @@ -877,14 +881,13 @@ func TestExecutor_CleanOldProcessesInCGroup(t *testing.T) {

execCmd := testExecCmd.command
execCmd.Cmd = "/bin/sleep"
execCmd.Args = []string{"20"}

execCmd.Args = []string{"1"}
execCmd.ResourceLimits = true
execCmd.ModePID = "private"
execCmd.ModeIPC = "private"

// Create the CGroup the executor's command will run in and populate it with one process
err := createCGroup(fullCGroupPath)
cgInterface, err := createCGroup(fullCGroupPath)
must.NoError(t, err)

cmd := exec.Command("/bin/sleep", "3000")
Expand All @@ -901,7 +904,6 @@ func TestExecutor_CleanOldProcessesInCGroup(t *testing.T) {
pid := cmd.Process.Pid
must.Positive(t, pid)

cgInterface := cgroupslib.OpenPath(fullCGroupPath)
err = cgInterface.Write("cgroup.procs", strconv.Itoa(pid))
must.NoError(t, err)

Expand Down

0 comments on commit c5cb91a

Please sign in to comment.