Skip to content

Commit

Permalink
testsuite: add namespace create with rootref tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chu11 committed Nov 5, 2021
1 parent b317a54 commit 21acfef
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions t/t1004-kvs-namespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ NAMESPACETEST=namespacetest
NAMESPACETMP=namespacetmp
NAMESPACERANK1=namespacerank1
NAMESPACEORDER=namespaceorder
NAMESPACEROOTREF=namespacerootref

namespace_create_loop() {
i=0
Expand Down Expand Up @@ -339,6 +340,39 @@ test_expect_success 'kvs: put - namespace specified in command line overrides en
test_kvs_key_namespace $NAMESPACEORDER-2 $DIR.puttest 5
'
#
# Namespace rootref initialization
#
test_expect_success HAVE_JQ 'kvs: namespace rootref setup' '
flux kvs namespace create $NAMESPACEROOTREF-1 &&
flux kvs put --namespace=$NAMESPACEROOTREF-1 $DIR.rootreftest=foobar &&
test_kvs_key_namespace $NAMESPACEROOTREF-1 $DIR.rootreftest foobar &&
flux kvs getroot --blobref --namespace=$NAMESPACEROOTREF-1 > rootref1
'
test_expect_success HAVE_JQ 'kvs: namespace create with init rootref' '
flux kvs namespace create --rootref=$(cat rootref1) $NAMESPACEROOTREF-2 &&
test_kvs_key_namespace $NAMESPACEROOTREF-1 $DIR.rootreftest foobar
'
test_expect_success HAVE_JQ 'kvs: namespaces dont clobber each other' '
flux kvs put --namespace=$NAMESPACEROOTREF-1 $DIR.val=42 &&
flux kvs put --namespace=$NAMESPACEROOTREF-2 $DIR.val=43 &&
test_kvs_key_namespace $NAMESPACEROOTREF-1 $DIR.val 42 &&
test_kvs_key_namespace $NAMESPACEROOTREF-2 $DIR.val 43
'
BADROOTREF="sha1-0123456789abcdef0123456789abcdef01234567"
test_expect_success HAVE_JQ 'kvs: namespace create can take bad blobref' '
flux kvs namespace create --rootref=$BADROOTREF $NAMESPACEROOTREF-3 &&
flux kvs get --namespace=$NAMESPACEROOTREF-3 --treeobj .
'
test_expect_success HAVE_JQ 'kvs: namespace with bad rootref fails otherwise' '
test_must_fail flux kvs ls --namespace=$NAMESPACEROOTREF-3 .
'
#
# Namespace corner case tests
#
Expand Down

0 comments on commit 21acfef

Please sign in to comment.