Skip to content

Commit

Permalink
t2700-mini-cmd.t: add more tests for flux-mini --setattr
Browse files Browse the repository at this point in the history
Problem: The flux-mini --setattr tests do not verify that --setattr=KEY
sets the attribute KEY in the system dictionary by default, and that
--setattr now defaults the value to 1 when value is not specified.

Test these conditions in the existing --setattr tests in
t2700-mini-cmd.t.

Also, update the test use jq directly to compare values instead of
reading the values with jq and comparing with test.
  • Loading branch information
grondo committed Aug 10, 2022
1 parent c79c4ff commit ac5f290
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions t/t2700-mini-cmd.t
Expand Up @@ -126,16 +126,23 @@ test_expect_success 'flux mini submit --time-limit=4-00:30:00 fails' '
'

test_expect_success HAVE_JQ 'flux mini submit --setattr works' '
flux mini submit --dry-run \
flux mini submit --env=-* --dry-run \
--setattr user.meep=false \
--setattr user.foo=\"xxx\" \
--setattr user.foo2=yyy \
--setattr foo \
--setattr .test=a \
--setattr test2=b \
--setattr system.bar=42 hostname >attr.out &&
test $(jq ".attributes.user.meep" attr.out) = "false" &&
test $(jq ".attributes.user.foo" attr.out) = "\"xxx\"" &&
test $(jq ".attributes.user.foo2" attr.out) = "\"yyy\"" &&
test $(jq ".attributes.system.bar" attr.out) = "42"
jq -e ".attributes.user.meep == false" attr.out &&
jq -e ".attributes.user.foo == \"xxx\"" attr.out &&
jq -e ".attributes.user.foo2 == \"yyy\"" attr.out &&
jq -e ".attributes.system.foo == 1" attr.out &&
jq -e ".attributes.test == \"a\"" attr.out &&
jq -e ".attributes.system.test2 == \"b\"" attr.out &&
jq -e ".attributes.system.bar == 42" attr.out
'

test_expect_success HAVE_JQ 'flux mini submit --setattr=^ATTR=VAL works' '
cat | jq -S . >attr.json <<-EOF &&
[
Expand Down

0 comments on commit ac5f290

Please sign in to comment.