|
| 1 | +#!/bin/sh |
| 2 | +#set -x |
| 3 | + |
| 4 | +test_description='Test the basic functionality of properties (get/set) within resource |
| 5 | +' |
| 6 | + |
| 7 | +. `dirname $0`/sharness.sh |
| 8 | + |
| 9 | +grug="${SHARNESS_TEST_SRCDIR}/data/resource/grugs/tiny.graphml" |
| 10 | +jobspec="${SHARNESS_TEST_SRCDIR}/data/resource/jobspecs/basics/test008.yaml" |
| 11 | + |
| 12 | +# |
| 13 | +# test_under_flux is under sharness.d/ |
| 14 | +# |
| 15 | +test_under_flux 1 |
| 16 | + |
| 17 | +# |
| 18 | +# print only with --debug |
| 19 | +# |
| 20 | + |
| 21 | +test_debug ' |
| 22 | + echo ${grug} |
| 23 | +' |
| 24 | + |
| 25 | +test_expect_success 'loading resource module with a tiny machine config works' ' |
| 26 | + load_resource \ |
| 27 | +load-file=${grug} load-format=grug \ |
| 28 | +prune-filters=ALL:core subsystems=containment policy=high |
| 29 | +' |
| 30 | + |
| 31 | +test_expect_success 'set-status basic test works' ' |
| 32 | + flux ion-resource find status=down | grep null && |
| 33 | + flux ion-resource set-status /tiny0/rack0/node0 down && |
| 34 | + flux ion-resource find status=down | grep node0 && |
| 35 | + flux ion-resource set-status /tiny0/rack0/node0 up && |
| 36 | + flux ion-resource find status=down | grep null |
| 37 | +' |
| 38 | + |
| 39 | +test_expect_success 'bad resource path produces an error' ' |
| 40 | + test_must_fail flux ion-resource set-status /foobar/not/a/vertex down |
| 41 | +' |
| 42 | + |
| 43 | +test_expect_success 'bad status produces an error' ' |
| 44 | + test_must_fail flux ion-resource set-status /tiny0/rack0/node0 foobar |
| 45 | +' |
| 46 | + |
| 47 | +test_expect_success 'set-status not-so-basic test works' ' |
| 48 | + flux ion-resource find status=down | grep null && |
| 49 | + flux ion-resource set-status /tiny0/rack0/node0 down && |
| 50 | + flux ion-resource find status=down | grep node0 && |
| 51 | + flux ion-resource set-status /tiny0/rack0/node1 down && |
| 52 | + flux ion-resource find status=down | grep "node\[0-1\]" && |
| 53 | + flux ion-resource set-status /tiny0/rack0/node0 up && |
| 54 | + flux ion-resource find status=down | grep node1 && |
| 55 | + flux ion-resource set-status /tiny0/rack0/node1 up && |
| 56 | + flux ion-resource find status=down | grep null |
| 57 | +' |
| 58 | + |
| 59 | +test_expect_success 'jobs fail when all nodes are marked down' ' |
| 60 | + flux ion-resource set-status /tiny0/rack0/node0 down && |
| 61 | + flux ion-resource set-status /tiny0/rack0/node1 down && |
| 62 | + flux ion-resource find status=up | grep null && |
| 63 | + flux ion-resource match satisfiability $jobspec && |
| 64 | + test_must_fail flux ion-resource match allocate $jobspec && |
| 65 | + flux ion-resource set-status /tiny0/rack0/node0 up && |
| 66 | + flux ion-resource set-status /tiny0/rack0/node1 up && |
| 67 | + flux ion-resource find status=down | grep null |
| 68 | +' |
| 69 | + |
| 70 | +test_expect_success 'jobs fail when all racks are marked down' ' |
| 71 | + flux ion-resource find status=down | grep null && |
| 72 | + flux ion-resource set-status /tiny0/rack0 down && |
| 73 | + flux ion-resource find status=up | grep null && |
| 74 | + flux ion-resource match satisfiability $jobspec && |
| 75 | + test_must_fail flux ion-resource match allocate $jobspec && |
| 76 | + flux ion-resource set-status /tiny0/rack0 up && |
| 77 | + flux ion-resource find status=down | grep null |
| 78 | +' |
| 79 | + |
| 80 | +test_expect_success 'removing resource works' ' |
| 81 | + remove_resource |
| 82 | +' |
| 83 | + |
| 84 | +test_done |
0 commit comments