@@ -171,6 +171,11 @@ test_expect_success 'job-archive: load module' '
171171 flux module load job-archive
172172'
173173
174+ test_expect_success ' job-archive: launch a running job' '
175+ jobid=`flux submit sleep inf` &&
176+ echo $jobid > long_running_job.id
177+ '
178+
174179test_expect_success ' job-archive: stores inactive job info (job good)' '
175180 jobid=`flux submit hostname` &&
176181 fj_wait_event $jobid clean &&
@@ -189,6 +194,27 @@ test_expect_success 'job-archive: stores inactive job info (job fail)' '
189194 db_check_values_run $jobid ${ARCHIVEDB}
190195'
191196
197+ # ensure long running job wasn't stored
198+ test_expect_success ' job-archive: check 2 jobs stored' '
199+ count=`db_count_entries ${ARCHIVEDB}` &&
200+ test $count -eq 2
201+ '
202+
203+ test_expect_success ' job-archive: cancel long running job' '
204+ jobid=$(cat long_running_job.id) &&
205+ flux cancel $jobid &&
206+ fj_wait_event $jobid clean &&
207+ wait_jobid_state $jobid inactive &&
208+ wait_db $jobid ${ARCHIVEDB} &&
209+ db_check_entries $jobid ${ARCHIVEDB} &&
210+ db_check_values_run $jobid ${ARCHIVEDB}
211+ '
212+
213+ test_expect_success ' job-archive: check 3 jobs stored' '
214+ count=`db_count_entries ${ARCHIVEDB}` &&
215+ test $count -eq 3
216+ '
217+
192218# to ensure job canceled before we run, we submit a job to eat up all
193219# resources first.
194220test_expect_success ' job-archive: stores inactive job info (job cancel)' '
@@ -217,7 +243,7 @@ test_expect_success 'job-archive: stores inactive job info (resources)' '
217243
218244test_expect_success ' job-archive: all jobs stored' '
219245 count=`db_count_entries ${ARCHIVEDB}` &&
220- test $count -eq 5
246+ test $count -eq 6
221247'
222248
223249test_expect_success ' job-archive: reload module' '
@@ -226,7 +252,7 @@ test_expect_success 'job-archive: reload module' '
226252
227253test_expect_success ' job-archive: doesnt restore old data' '
228254 count=`db_count_entries ${ARCHIVEDB}` &&
229- test $count -eq 5
255+ test $count -eq 6
230256'
231257
232258test_expect_success ' job-archive: stores more inactive job info' '
@@ -246,7 +272,7 @@ test_expect_success 'job-archive: stores more inactive job info' '
246272
247273test_expect_success ' job-archive: all jobs stored' '
248274 count=`db_count_entries ${ARCHIVEDB}` &&
249- test $count -eq 7
275+ test $count -eq 8
250276'
251277
252278# we don't check values in module stats b/c it can be racy w/ polling
@@ -260,7 +286,7 @@ test_expect_success 'job-archive: unload module' '
260286
261287test_expect_success ' job-archive: db exists after module unloaded' '
262288 count=`db_count_entries ${ARCHIVEDB}` &&
263- test $count -eq 7
289+ test $count -eq 8
264290'
265291
266292test_expect_success ' job-archive: setup config file without dbpath' '
0 commit comments