Skip to content

Commit

Permalink
testsuite: add test for early shell fatal error handling
Browse files Browse the repository at this point in the history
Problem: No test in the testsuite ensures that early job shell errors,
such as a failure to parse jobspec, are displayed in `flux job attach`
output.

Add a test to t2608-job-shell-log.t that submits a jobspec with
version=2 and ensures the expected error message is emitted.
  • Loading branch information
grondo committed Jan 24, 2025
1 parent 5fbee79 commit 56b82af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions t/t2608-job-shell-log.t
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,18 @@ test_expect_success 'flux-shell: stdout/err from task.exec works' '
grep "^this is stderr" print.err &&
grep "^this is stdout" print.out
'
# Note: the following test uses alloc-bypass.so to bypass the scheduler in
# order to introduce a jobspec error, to be caught by the job shell early
# in initialization.
test_expect_success 'flux-shell: early fatal errors are captured in eventlog' '
flux jobtap load alloc-bypass.so &&
id=$(flux run --dry-run -Salloc-bypass.R="$(flux resource R -i0)" true | \
jq .version=2 | \
flux job submit --flags=novalidate) &&
echo jobid=$id &&
flux job wait-event -Hvt 30 $id clean &&
test_expect_code 1 flux job attach $id >early-errors.out 2>&1 &&
grep "error parsing jobspec" early-errors.out &&
flux jobtap remove alloc-bypass.so
'
test_done

0 comments on commit 56b82af

Please sign in to comment.