|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | + |
| 4 | +test_description='Test kvs module initial-rootref option' |
| 5 | + |
| 6 | +. `dirname $0`/kvs/kvs-helper.sh |
| 7 | + |
| 8 | +. `dirname $0`/sharness.sh |
| 9 | + |
| 10 | +RPC=${FLUX_BUILD_DIR}/t/request/rpc |
| 11 | + |
| 12 | +export FLUX_CONF_DIR=$(pwd) |
| 13 | +SIZE=4 |
| 14 | +test_under_flux ${SIZE} minimal -Sstatedir=$(pwd) |
| 15 | + |
| 16 | +test_expect_success 'load content, content-sqlite, and kvs' ' |
| 17 | + flux module load content && |
| 18 | + flux module load content-sqlite && |
| 19 | + flux module load kvs |
| 20 | +' |
| 21 | + |
| 22 | +test_expect_success 'kvs: put some data to kvs' ' |
| 23 | + flux kvs put --blobref data=1 > blob1.out && |
| 24 | + flux kvs put --blobref data=2 > blob2.out && |
| 25 | + flux kvs put --blobref data=3 > blob3.out && |
| 26 | + flux kvs put --blobref data=4 > blob4.out && |
| 27 | + flux kvs put --blobref data=5 > blob5.out |
| 28 | +' |
| 29 | + |
| 30 | +test_expect_success 'kvs: reload kvs' ' |
| 31 | + flux module reload kvs |
| 32 | +' |
| 33 | + |
| 34 | +test_expect_success 'kvs: data should be last written' ' |
| 35 | + echo "5" > data1.exp && |
| 36 | + flux kvs get data > data1.out && |
| 37 | + test_cmp data1.out data1.exp |
| 38 | +' |
| 39 | + |
| 40 | +test_expect_success 'kvs: root should be last one' ' |
| 41 | + flux kvs getroot -b > getroot1.out && |
| 42 | + test_cmp getroot1.out blob5.out |
| 43 | +' |
| 44 | + |
| 45 | +test_expect_success 'kvs: reload kvs with different initial rootref' ' |
| 46 | + ref=$(cat blob3.out) && |
| 47 | + flux module reload kvs initial-rootref="$ref" |
| 48 | +' |
| 49 | + |
| 50 | +test_expect_success 'kvs: data should be previous one' ' |
| 51 | + echo "3" > data2.exp && |
| 52 | + flux kvs get data > data2.out && |
| 53 | + test_cmp data2.out data2.exp |
| 54 | +' |
| 55 | + |
| 56 | +test_expect_success 'kvs: root should be previous one' ' |
| 57 | + flux kvs getroot -b > getroot2.out && |
| 58 | + test_cmp getroot2.out blob3.out |
| 59 | +' |
| 60 | + |
| 61 | +test_expect_success 'kvs: remove kvs module' ' |
| 62 | + flux module remove kvs |
| 63 | +' |
| 64 | + |
| 65 | +test_expect_success 'kvs: load kvs with bad rootref' ' |
| 66 | + test_must_fail flux module reload kvs initial-rootref="abcdefghijklmnop" |
| 67 | +' |
| 68 | + |
| 69 | +test_expect_success 'kvs: remove modules' ' |
| 70 | + flux module remove content-sqlite && |
| 71 | + flux module remove content |
| 72 | +' |
| 73 | + |
| 74 | +test_done |
0 commit comments