Skip to content

Commit

Permalink
testsuite: add test that ensures the IMP waits for an empty cgroup
Browse files Browse the repository at this point in the history
Problem: No test ensures that imp exec waits for the job cgroup to
be empty before exiting.

Add a test that sends SIGTERM to an IMP managing a process tree.
This kills the immediate child of the IMP, and the IMP must wait
until SIGUSR1 is sent, which terminates the cgroup with SIGKILL.
  • Loading branch information
grondo committed Nov 1, 2024
1 parent 3feae11 commit 1e23343
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions t/t2000-imp-exec.t
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,22 @@ test_expect_success SUDO,CGROUPFS,NO_CHAIN_LINT \
test_must_be_empty ${CGROUP_PATH}/cgroup.procs
'
test_expect_success SUDO,CGROUPFS,NO_CHAIN_LINT \
'flux-imp exec: SIGUSR1 waits for cgroup to be empty' '
fake_input_sign_none | \
$SUDO FLUX_IMP_CONFIG_PATTERN=sign-none.toml \
./run-in-cgroup.sh "$CGROUP_PATH" \
$flux_imp exec $(pwd)/sleeper.sh 15 &
imp_pid=$! &&
test_when_finished "rm -f sleeper.pid" &&
wait_for_file sleeper.pid &&
kill -TERM $(cat sleeper.pid) &&
sleep .5 &&
kill -USR1 $(cat sleeper.pid) &&
test_expect_code 143 wait $imp_pid &&
test_must_be_empty ${CGROUP_PATH}/cgroup.procs
'
$flux_imp version | grep -q pam || test_set_prereq NO_PAM
test_expect_success NO_PAM,SUDO 'flux-imp exec: fails if not built with PAM but pam-support=true' '
( export FLUX_IMP_CONFIG_PATTERN=pam-test.toml &&
Expand Down

0 comments on commit 1e23343

Please sign in to comment.