-
Notifications
You must be signed in to change notification settings - Fork 49
/
t2100-aggregate.t
executable file
·88 lines (73 loc) · 2.91 KB
/
t2100-aggregate.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
test_description='Test basic flux aggreagation via aggregator module'
. `dirname $0`/sharness.sh
test_under_flux 8 wreck
kvscheck="$SHARNESS_TEST_SRCDIR/scripts/kvs-get-ex.lua"
test_expect_success 'have aggregator module' '
flux module list -r all | grep aggregator
'
test_expect_success 'flux-aggreagate: works' '
run_timeout 2 flux exec -r 0-7 flux aggregate test 1 &&
$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
'
test_expect_success 'flux-aggregate: different value per rank' '
run_timeout 2 flux exec -r 0-7 bash -c "flux aggregate test \$(flux getattr rank)" &&
$kvstest test "x.count == 8" &&
$kvstest test "x.min == 0" &&
$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" &&
$kvstest test "x.total == 8" &&
$kvstest test "x.min == 1" &&
$kvstest test "x.max == 1"
'
test_expect_success 'flux-aggregate: --fwd-count works' '
run_timeout 2 flux exec -r 0-7 bash -c \
"flux aggregate -t10 -c \$((1+\$(flux getattr tbon.descendants))) test 1" &&
$kvstest test "x.count == 8" &&
$kvstest test "x.total == 8" &&
$kvstest test "x.min == 1" &&
$kvstest test "x.max == 1"
'
test_done
# vi: ts=4 sw=4 expandtab