Skip to content

Commit

Permalink
t/kvs: Update t1002-kvs-extra tests for RFC 11
Browse files Browse the repository at this point in the history
Update t1002-kvs-extra.t tests for RFC 11, notably adjusting
former dirent types (i.e. FILEVAL) for treeobj types (i.e. "val").
  • Loading branch information
chu11 committed Aug 18, 2017
1 parent 71f975a commit 2282f46
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions t/t1002-kvs-extra.t
Original file line number Diff line number Diff line change
Expand Up @@ -158,34 +158,34 @@ test_expect_success 'kvs: get_symlinkat works after symlink unlinked' '
test "$LINKVAL" = "$TEST.a.b.X"
'

test_expect_success 'kvs: get-treeobj: returns directory reference for root' '
test_expect_success 'kvs: get-treeobj: returns dirref object for root' '
flux kvs unlink -Rf $TEST &&
${KVSBASIC} get-treeobj . | grep -q "DIRREF"
${KVSBASIC} get-treeobj . | grep -q \"dirref\"
'

test_expect_success 'kvs: get-treeobj: returns directory reference for directory' '
test_expect_success 'kvs: get-treeobj: returns dirref object for directory' '
flux kvs unlink -Rf $TEST &&
flux kvs mkdir $TEST.a &&
${KVSBASIC} get-treeobj $TEST.a | grep -q "DIRREF"
${KVSBASIC} get-treeobj $TEST.a | grep -q \"dirref\"
'

test_expect_success 'kvs: get-treeobj: returns value for small value' '
test_expect_success 'kvs: get-treeobj: returns val object for small value' '
flux kvs unlink -Rf $TEST &&
flux kvs put $TEST.a=b &&
${KVSBASIC} get-treeobj $TEST.a | grep -q "FILEVAL"
${KVSBASIC} get-treeobj $TEST.a | grep -q \"val\"
'

test_expect_success 'kvs: get-treeobj: returns value ref for large value' '
flux kvs unlink -Rf $TEST &&
dd if=/dev/zero bs=4096 count=1 | ${KVSBASIC} copy-tokvs $TEST.a - &&
${KVSBASIC} get-treeobj $TEST.a | grep -q "FILEREF"
${KVSBASIC} get-treeobj $TEST.a | grep -q \"valref\"
'

test_expect_success 'kvs: get-treeobj: returns link value for symlink' '
flux kvs unlink -Rf $TEST &&
flux kvs put $TEST.a.b.X=42 &&
flux kvs link $TEST.a.b.X $TEST.a.b.link &&
${KVSBASIC} get-treeobj $TEST.a.b.link | grep -q LINKVAL
${KVSBASIC} get-treeobj $TEST.a.b.link | grep -q \"symlink\"
'

test_expect_success 'kvs: put-treeobj: can make root snapshot' '
Expand All @@ -212,31 +212,31 @@ test_expect_success 'kvs: put-treeobj: fails bad dirent: not JSON' '

test_expect_success 'kvs: put-treeobj: fails bad dirent: unknown type' '
flux kvs unlink -Rf $TEST &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"ERSTWHILE\":\"fubar\"}"
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"data\":\"MQA=\",\"type\":\"FOO\",\"ver\":1}"
'

test_expect_success 'kvs: put-treeobj: fails bad dirent: bad link type' '
test_expect_success 'kvs: put-treeobj: fails bad dirent: bad link data' '
flux kvs unlink -Rf $TEST &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"LINKVAL\":42}"
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"data\":42,\"type\":\"symlink\",\"ver\":1}"
'

test_expect_success 'kvs: put-treeobj: fails bad dirent: bad ref type' '
test_expect_success 'kvs: put-treeobj: fails bad dirent: bad ref data' '
flux kvs unlink -Rf $TEST &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"DIRREF\":{}}"
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"data\":42,\"type\":\"dirref\",\"ver\":1}"
'

test_expect_success 'kvs: put-treeobj: fails bad dirent: bad blobref' '
flux kvs unlink -Rf $TEST &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"DIRREF\":\"sha2-aaa\"}" &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"DIRREF\":\"sha1-bbb\"}"
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"data\":[\"sha1-aaa\"],\"type\":\"dirref\",\"ver\":1}" &&
test_must_fail ${KVSBASIC} put-treeobj $TEST.a="{\"data\":[\"sha1-bbb\"],\"type\":\"dirref\",\"ver\":1}"
'

test_expect_success 'kvs: getat: fails bad on dirent' '
flux kvs unlink -Rf $TEST &&
test_must_fail ${KVSBASIC} getat 42 $TEST.a &&
test_must_fail ${KVSBASIC} getat "{\"DIRREF\":\"sha2-aaa\"}" $TEST.a &&
test_must_fail ${KVSBASIC} getat "{\"DIRREF\":\"sha1-bbb\"}" $TEST.a &&
test_must_fail ${KVSBASIC} getat "{\"DIRVAL\":{}}" $TEST.a
test_must_fail ${KVSBASIC} getat "{\"data\":[\"sha1-aaa\"],\"type\":\"dirref\",\"ver\":1}" $TEST.a &&
test_must_fail ${KVSBASIC} getat "{\"data\":[\"sha1-bbb\"],\"type\":\"dirref\",\"ver\":1}" $TEST.a &&
test_must_fail ${KVSBASIC} getat "{\"data\":42,\"type\":\"dirref\",\"ver\":1}" $TEST.a
'

test_expect_success 'kvs: getat: works on root from get-treeobj' '
Expand Down

0 comments on commit 2282f46

Please sign in to comment.