Skip to content

Commit

Permalink
testsuite: cover root job history
Browse files Browse the repository at this point in the history
Problem: there is no test coverage for the job history plugin
storing a history for userid 0.

Add a test.
  • Loading branch information
garlick committed Dec 7, 2023
1 parent 341f45f commit a8c4882
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions t/t2812-flux-job-last.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ test_description='Test the flux job last command'

. $(dirname $0)/sharness.sh

flux version | grep -q libflux-security && test_set_prereq FLUX_SECURITY

test_under_flux 1

test_expect_success 'flux-job last fails on invalid arguments' '
Expand Down Expand Up @@ -50,4 +52,22 @@ test_expect_success 'flux-job last does not list purged jobs' '
grep "job history is empty" nojob2.err
'

submit_as_root()
{
FAKE_USERID=0
test_debug "echo running flux run $@ as userid $FAKE_USERID"
flux run --dry-run "$@" | \
flux python ${SHARNESS_TEST_SRCDIR}/scripts/sign-as.py $FAKE_USERID \
>job.signed
FLUX_HANDLE_USERID=$FAKE_USERID \
flux job submit --flags=signed job.signed
}

# issue #5475
# Execution may fail but submission should work - enough for this test
test_expect_success FLUX_SECURITY 'run a job as fake root' '
submit_as_root true &&
FLUX_HANDLE_USERID=0 flux job last
'

test_done

0 comments on commit a8c4882

Please sign in to comment.