|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +test_description='Test flux post-job-event command' |
| 4 | + |
| 5 | +. $(dirname $0)/sharness.sh |
| 6 | + |
| 7 | +test_under_flux 1 |
| 8 | + |
| 9 | +test_expect_success 'run a test job' ' |
| 10 | + JOBID=$(flux submit --wait-event=start sleep inf) |
| 11 | +' |
| 12 | +test_expect_success 'flux-post-job-event --help works' ' |
| 13 | + flux post-job-event --help >help.out && |
| 14 | + test_debug "cat help.out" && |
| 15 | + grep "name of event to post" help.out |
| 16 | +' |
| 17 | +test_expect_success 'flux-post-job-event can post a simple event' ' |
| 18 | + flux post-job-event $JOBID test && |
| 19 | + flux job wait-event -t15 $JOBID test |
| 20 | +' |
| 21 | +test_expect_success 'flux-post-job-event can post an event with context' ' |
| 22 | + flux post-job-event $JOBID test note=testing && |
| 23 | + flux job wait-event -m note=testing -t15 $JOBID test |
| 24 | +' |
| 25 | +test_expect_success 'flux-post-job-event can post multiple context keys' ' |
| 26 | + flux post-job-event $JOBID test note=test2 status=0 && |
| 27 | + flux job wait-event -m note=test2 -t15 $JOBID test && |
| 28 | + flux job wait-event -m status=0 -t15 $JOBID test |
| 29 | +' |
| 30 | +test_expect_success 'flux-post-job-event fails for invalid job' ' |
| 31 | + test_must_fail flux post-job-event f123 test note="test event" |
| 32 | +' |
| 33 | +test_expect_success 'flux-post-job-event fails for inactive job' ' |
| 34 | + flux cancel $JOBID && |
| 35 | + flux job wait-event $JOBID clean && |
| 36 | + test_must_fail flux post-job-event $JOBID test note="test event" |
| 37 | +' |
| 38 | +test_expect_success 'flux-post-job-event fails with invalid id' ' |
| 39 | + test_must_fail flux post-job-event baz test |
| 40 | +' |
| 41 | +test_done |
0 commit comments