Skip to content

Commit

Permalink
test: Add basic test for cancel and info handlers within resource
Browse files Browse the repository at this point in the history
Test the functionality of the cancel and info handlers within
resource module using flux-resource front-end command.

Update Makefile rule.
  • Loading branch information
dongahn committed Sep 7, 2018
1 parent f23a0bc commit 0f3d8b0
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ TESTS = \
t3010-resource-power.t \
t4001-match-allocate.t \
t4002-match-reserve.t \
t4003-cancel-info.t \
t5000-valgrind.t

check_SCRIPTS = $(TESTS)
Expand Down
80 changes: 80 additions & 0 deletions t/t4003-cancel-info.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/sh
#set -x

test_description='Test the basic functionality of cancel and info within resource
Ensure that the cancel and info handlers within the resource module works
'

. `dirname $0`/sharness.sh

grug="${SHARNESS_TEST_SRCDIR}/data/resource/grugs/tiny.graphml"
jobspec="${SHARNESS_TEST_SRCDIR}/data/resource/jobspecs/basics/test001.yaml"

#
# test_under_flux is under sharness.d/
#
test_under_flux 1

#
# print only with --debug
#
test_debug '
echo ${grug} &&
echo ${jobspec}
'

test_expect_success 'loading resource module with a tiny machine config works' '
flux module load resource grug-conf=${grug} \
subsystems=containment policy=high
'

test_expect_success 'resource-cancel works' '
flux resource match allocate ${jobspec} &&
flux resource cancel 0 &&
flux resource match allocate ${jobspec} &&
flux resource cancel 1 &&
flux resource match allocate ${jobspec} &&
flux resource cancel 2 &&
flux resource match allocate ${jobspec} &&
flux resource cancel 3
'

test_expect_success 'resource-info on cancelled jobs works' '
flux resource info 0 > info.0 &&
flux resource info 1 > info.1 &&
flux resource info 2 > info.2 &&
flux resource info 3 > info.3 &&
grep CANCELLED info.0 &&
grep CANCELLED info.1 &&
grep CANCELLED info.2 &&
grep CANCELLED info.3
'

test_expect_success 'allocate works with 1-node/1-socket after cancels' '
flux resource match allocate ${jobspec} &&
flux resource match allocate ${jobspec} &&
flux resource match allocate ${jobspec} &&
flux resource match allocate ${jobspec}
'

test_expect_success 'resource-info on allocated jobs works' '
flux resource info 4 > info.4 &&
flux resource info 5 > info.5 &&
flux resource info 6 > info.6 &&
flux resource info 7 > info.7 &&
grep ALLOCATED info.4 &&
grep ALLOCATED info.5 &&
grep ALLOCATED info.6 &&
grep ALLOCATED info.7
'

test_expect_success 'cancel on nonexistent jobid is handled gracefully' '
test_expect_code 1 flux resource cancel 100000
'

test_expect_success 'removing resource works' '
flux module remove resource
'

test_done

0 comments on commit 0f3d8b0

Please sign in to comment.