Skip to content

Commit

Permalink
t2801-top-cmd.t: fix tests now that flux-top uses flux-uri
Browse files Browse the repository at this point in the history
Problem: Many flux-top expected failure tests now fail since flux-top
resolves its target argument with flux_uri_resolve().

Updated expected failure output and other tests in t2801-top-cmd.t.
  • Loading branch information
grondo committed Dec 14, 2021
1 parent 76a9540 commit 5e2d7e2
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions t/t2801-top-cmd.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ testssh="${SHARNESS_TEST_SRCDIR}/scripts/tssh"

test_expect_success 'flux-top -h prints custom usage' '
flux top -h 2>usage &&
grep "Usage:.*JOBID" usage
grep "Usage:.*TARGET" usage
'
test_expect_success 'flux-top fails on unknown option' '
test_must_fail flux top --notopt 2>notopt.err &&
Expand All @@ -22,20 +22,22 @@ test_expect_success 'flux-top fails if FLUX_URI is set wrong' '
(FLUX_URI=noturi test_must_fail flux top) 2>baduri.err &&
grep "connecting to Flux" baduri.err
'
test_expect_success 'flux-top fails if job argument is not a job ID' '
test_must_fail flux top notjob 2>badjobid.err &&
grep "failed to parse JOBID" badjobid.err
test_expect_success 'flux-top fails if job argument is not a valid URI' '
test_must_fail flux top baduri 2>baduri.err &&
test_debug "cat baduri.err" &&
grep "failed to resolve" baduri.err
'
test_expect_success 'flux-top fails if job argument is unknown' '
test_must_fail flux top 12345 2>unkjobid.err &&
grep "unknown job" unkjobid.err
grep "jobid 12345 not found" unkjobid.err
'
test_expect_success 'run a test job to completion' '
flux mini submit --wait -n1 /bin/true >jobid
flux mini submit --wait -n1 flux start /bin/true >jobid
'
test_expect_success 'flux-top fails if job is not running' '
test_must_fail flux top $(cat jobid) 2>notrun.err &&
grep "job is not running" notrun.err
test_must_fail flux top $(cat jobid)?local 2>notrun.err &&
test_debug "cat notrun.err" &&
grep "error connecting to Flux" notrun.err
'
test_expect_success 'flux-top fails if stdin is not a tty' '
test_must_fail flux top --test-exit </dev/null 2>notty.err &&
Expand Down Expand Up @@ -67,7 +69,8 @@ test_expect_success 'flux-top JOBID fails when JOBID is not a flux instance' '
FLUX_SSH=$testssh test_must_fail \
$runpty --format=asciicast -o notflux.log \
flux top --test-exit $(cat jobid3) &&
grep "not a Flux instance" notflux.log
test_debug "cat notflux.log" &&
grep "URI not found" notflux.log
'
test_expect_success NO_CHAIN_LINT 'flux-top quits on q keypress' '
$runpty --quit-char=q --format=asciicast -o keys.log flux top &
Expand Down

0 comments on commit 5e2d7e2

Please sign in to comment.