Skip to content

Commit

Permalink
t2100-aggregate.t: Expand aggregator testing
Browse files Browse the repository at this point in the history
Add tests to ensure floating point, string, and complex object types
work as the value target of aggregates.
  • Loading branch information
grondo committed May 29, 2018
1 parent 90938bb commit a3563f9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions t/t2100-aggregate.t
Expand Up @@ -17,6 +17,35 @@ test_expect_success 'flux-aggreagate: works' '
$kvscheck test "x.count == 8"
'

test_expect_success 'flux-aggreagate: works for floating-point numbers' '
run_timeout 2 flux exec -r 0-7 flux aggregate test 1.825 &&
$kvscheck test "x.count == 8" &&
$kvscheck test "x.min == 1.825" &&
$kvscheck test "x.max == 1.825"
'
test_expect_success 'flux-aggreagate: works for strings' '
run_timeout 2 flux exec -r 0-7 flux aggregate test foo &&
flux kvs get test &&
$kvscheck test "x.count == 8" &&
$kvscheck test "x.entries[\"[0-7]\"] == \"foo\""
'
test_expect_success 'flux-aggreagate: works for arrays' '
run_timeout 2 flux exec -r 0-7 flux aggregate -e "{7,8,9}" test &&
flux kvs get test &&
$kvscheck test "x.count == 8" &&
$kvscheck test "#x.entries[\"[0-7]\"] == 3" &&
$kvscheck test "x.entries[\"[0-7]\"][1] == 7" &&
$kvscheck test "x.entries[\"[0-7]\"][2] == 8" &&
$kvscheck test "x.entries[\"[0-7]\"][3] == 9"
'
test_expect_success 'flux-aggreagate: works for objects' '
run_timeout 2 flux exec -r 0-7 flux aggregate \
-e "{foo = 42, bar = {baz = 2}}" test &&
flux kvs get test &&
$kvscheck test "x.count == 8" &&
$kvscheck test "x.entries[\"[0-7]\"].foo == 42" &&
$kvscheck test "x.entries[\"[0-7]\"].bar.baz == 2"
'
test_expect_success 'flux-aggregate: abort works' '
test_expect_code 1 run_timeout 5 flux exec -r 0-7 flux aggregate . 1
'
Expand All @@ -28,6 +57,13 @@ test_expect_success 'flux-aggregate: different value per rank' '
$kvstest test "x.max == 7"
'

test_expect_success 'flux-aggregate: different fp value per rank' '
run_timeout 2 flux exec -r 0-7 bash -c "flux aggregate test 1.\$(flux getattr rank)" &&
$kvstest test "x.count == 8" &&
$kvstest test "x.min == 1" &&
$kvstest test "x.max == 1.7"
'

test_expect_success 'flux-aggregate: --timeout=0. - immediate forward' '
run_timeout 2 flux exec -r 0-7 flux aggregate -t 0. test 1 &&
$kvstest test "x.count == 8" &&
Expand Down

0 comments on commit a3563f9

Please sign in to comment.