Skip to content

Commit

Permalink
flux-kvs: test that 'put' sets appropriate type
Browse files Browse the repository at this point in the history
Check that boolean, double, int, and string are correctly
typed by flux-kvs.
  • Loading branch information
garlick committed Oct 16, 2014
1 parent 5ae57b7 commit 8c37de0
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion t/t1000-kvs-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ test_kvs_key() {
#fi
}

test_kvs_type () {
flux kvs type "$1" >output
echo "$2" >expected
test_cmp output expected
}

test_expect_success 'kvs: get a nonexistent key' '
test_must_fail flux kvs get NOT.A.KEY
'
Expand All @@ -35,6 +41,9 @@ test_expect_success 'kvs: get a nonexistent key' '
test_expect_success 'kvs: integer put' '
flux kvs put $KEY=42
'
test_expect_success 'kvs: integer type' '
test_kvs_type $KEY int
'
test_expect_success 'kvs: integer get' '
test_kvs_key $KEY 42
'
Expand All @@ -44,13 +53,17 @@ test_expect_success 'kvs: unlink works' '
'
test_expect_success 'kvs: value can be empty' '
flux kvs put $KEY= &&
test_kvs_key $KEY ""
test_kvs_key $KEY "" &&
test_kvs_type $KEY string
'
KEY=$TEST.b.c.d
DIR=$TEST.b.c
test_expect_success 'kvs: string put' '
flux kvs put $KEY="Hello world"
'
test_expect_success 'kvs: string type' '
test_kvs_type $KEY string
'
test_expect_success 'kvs: string get' '
test_kvs_key $KEY "Hello world"
'
Expand All @@ -61,6 +74,9 @@ test_expect_success 'kvs: unlink works' '
test_expect_success 'kvs: boolean put (true)' '
flux kvs put $KEY=true
'
test_expect_success 'kvs: boolean type' '
test_kvs_type $KEY boolean
'
test_expect_success 'kvs: boolean get (true)' '
test_kvs_key $KEY true
'
Expand All @@ -71,6 +87,9 @@ test_expect_success 'kvs: unlink works' '
test_expect_success 'kvs: boolean put (false)' '
flux kvs put $KEY=false
'
test_expect_success 'kvs: boolean type' '
test_kvs_type $KEY boolean
'
test_expect_success 'kvs: boolean get (false)' '
test_kvs_key $KEY false
'
Expand All @@ -81,6 +100,9 @@ test_expect_success 'kvs: unlink works' '
test_expect_success 'kvs: put double' '
flux kvs put $KEY=3.14159
'
test_expect_success 'kvs: double type' '
test_kvs_type $KEY double
'
test_expect_success 'kvs: get double' '
test_kvs_key $KEY 3.141590
'
Expand Down

0 comments on commit 8c37de0

Please sign in to comment.