Skip to content

Commit

Permalink
t/kvs: Add new namespace tests
Browse files Browse the repository at this point in the history
Add tests to ensure priority ordring of how you specify a namespace
works as expected.
  • Loading branch information
chu11 committed Feb 8, 2018
1 parent 828f5fb commit f173ad1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions t/t1004-kvs-namespace.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PRIMARYNAMESPACE=primary
NAMESPACETEST=namespacetest
NAMESPACETMP=namespacetmp
NAMESPACERANK1=namespacerank1
NAMESPACEORDER=namespaceorder

namespace_create_loop() {
i=0
Expand Down Expand Up @@ -285,6 +286,41 @@ test_expect_success 'kvs: namespace can be re-created after remove, recognized o
flux kvs namespace-remove $NAMESPACETMP-ALL
'

#
# Namespace specification priority
#

test_expect_success 'kvs: namespace order setup' '
flux kvs namespace-create $NAMESPACEORDER-1 &&
flux kvs namespace-create $NAMESPACEORDER-2 &&
flux kvs --namespace=$PRIMARYNAMESPACE put $DIR.ordertest=1 &&
flux kvs --namespace=$NAMESPACEORDER-1 put $DIR.ordertest=2 &&
flux kvs --namespace=$NAMESPACEORDER-2 put $DIR.ordertest=3 &&
test_kvs_key_namespace $PRIMARYNAMESPACE $DIR.ordertest 1 &&
test_kvs_key_namespace $NAMESPACEORDER-1 $DIR.ordertest 2 &&
test_kvs_key_namespace $NAMESPACEORDER-2 $DIR.ordertest 3
'

test_expect_success 'kvs: no namespace specified, defaults to primary namespace' '
test_kvs_key $DIR.ordertest 1
'

test_expect_success 'kvs: namespace specified in environment variable works' '
export FLUX_KVS_NAMESPACE=$NAMESPACEORDER-1 &&
test_kvs_key $DIR.ordertest 2 &&
unset FLUX_KVS_NAMESPACE &&
export FLUX_KVS_NAMESPACE=$NAMESPACEORDER-2 &&
test_kvs_key $DIR.ordertest 3 &&
unset FLUX_KVS_NAMESPACE
'

test_expect_success 'kvs: namespace specified in command line overrides environment variable' '
export FLUX_KVS_NAMESPACE=$NAMESPACETMP-BAD &&
test_kvs_key_namespace $NAMESPACEORDER-1 $DIR.ordertest 2 &&
test_kvs_key_namespace $NAMESPACEORDER-2 $DIR.ordertest 3 &&
unset FLUX_KVS_NAMESPACE
'

#
# Namespace corner case tests
#
Expand Down

0 comments on commit f173ad1

Please sign in to comment.