Skip to content

Commit

Permalink
testsuite: exercise new flux-job subcommands
Browse files Browse the repository at this point in the history
Also fix a problem where a bad FLUX_URI setting
that was supposed to be local to a test was set
for the entire script.
  • Loading branch information
garlick committed Oct 29, 2018
1 parent 8ebffd5 commit 62a3c91
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions t/t2201-job-cmd.t
Expand Up @@ -10,9 +10,12 @@ fi

if flux job submitbench --help 2>&1 | grep -q sign-type; then
test_set_prereq HAVE_FLUX_SECURITY
SUBMITBENCH_OPT_R="--reuse-signature"
SUBMITBENCH_OPT_NONE="--sign-type=none"
fi

JOBSPEC=${SHARNESS_TEST_SRCDIR}/jobspec
SUBMITBENCH="flux job submitbench $SUBMITBENCH_OPT_NONE"

# 2^64 - 1
MAXJOBID_DEC=18446744073709551615
Expand All @@ -27,6 +30,11 @@ test_under_flux 1 job

flux setattr log-stderr-level 1

test_expect_success 'flux-job: submit one job to get one valid job in queue' '
validjob=$(${SUBMITBENCH} ${JOBSPEC}/valid/basic.yaml) &&
echo Valid job is ${validjob}
'

test_expect_success 'flux-job: unknown sub-command fails with usage message' '
test_must_fail flux job wrongsubcmd 2>usage.out &&
grep -q Usage: usage.out
Expand All @@ -47,8 +55,7 @@ test_expect_success 'flux-job: submitbench with nonexistent jobpsec fails' '
'

test_expect_success 'flux-job: submitbench with bad broker connection fails' '
FLUX_URI=/wrong \
test_must_fail flux job submitbench \
! FLUX_URI=/wrong flux job submitbench \
--sign-type=none \
${JOBSPEC}/valid/basic.yaml
'
Expand Down Expand Up @@ -141,6 +148,49 @@ test_expect_success 'flux-job: id --from=words fails on bad input' '
test_must_fail flux job id --from=words badwords
'

test_expect_success 'flux-job: priority fails with bad FLUX_URI' '
! FLUX_URI=/wrong flux job priority ${validjob} 0
'

test_expect_success 'flux-job: priority fails with non-numeric jobid' '
test_must_fail flux job priority foo 0
'

test_expect_success 'flux-job: priority fails with wrong number of arguments' '
test_must_fail flux job priority ${validjob}
'

test_expect_success 'flux-job: priority fails with non-numeric priority' '
test_must_fail flux job priority ${validjob} foo
'

test_expect_success 'flux-job: purge fails with bad FLUX_URI' '
! FLUX_URI=/wrong flux job purge ${validjob}
'

test_expect_success 'flux-job: purge fails with no args' '
test_must_fail flux job purge
'

test_expect_success 'flux-job: purge fails with invalid jobid' '
test_must_fail flux job purge foo
'

test_expect_success 'flux-job: list fails with bad FLUX_URI' '
! FLUX_URI=/wrong flux job list
'

test_expect_success 'flux-job: list fails with wrong number of arguments' '
test_must_fail flux job list foo
'

test_expect_success 'flux-job: list -s suppresses header' '
flux job list >list.out &&
grep -q JOBID list.out &&
flux job list -s >list_s.out &&
test_must_fail grep -q JOBID list_s.out
'

test_expect_success 'flux-job: id works with spaces in input' '
(echo "42"; echo "42") >despace.exp &&
(echo "42 "; echo " 42") | flux job id >despace.out &&
Expand Down

0 comments on commit 62a3c91

Please sign in to comment.