Skip to content

Commit 06c0437

Browse files
committed
Recreate macaroon if root: caveat is not set correctly
1 parent 4474bf8 commit 06c0437

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/integration_test.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@ oneTimeSetUp() {
451451
token=$(sed -n 's/^bearer_token *= *//p' "$token_file")
452452
check_token "$token"
453453
error=$?
454+
# Check if root: caveat is set correctly.
455+
ada/ada --viewtoken --tokenfile "$token_file" | grep "cid root" >/dev/null
456+
result=$?
457+
if [ $chroot = true ] && [ $result -eq 1 ] ; then # expecting macaroon with root: caveat
458+
error=1
459+
elif [ $chroot = false ] && [ $result -eq 0 ] ; then # expecting macaroon without root: caveat
460+
error=1
461+
fi
454462
if [ $error -eq 1 ]; then
455463
echo "The tests expect a valid macaroon. Please enter your CUA credentials to create one."
456464
if [ $chroot = true ] ; then
@@ -464,6 +472,7 @@ oneTimeSetUp() {
464472
fi
465473
token=$(sed -n 's/^bearer_token *= *//p' "$token_file")
466474
fi
475+
467476
# curl options for various activities;
468477
curl_options_common=(
469478
-H "accept: application/json"
@@ -479,7 +488,6 @@ oneTimeSetUp() {
479488
# Refer to the file with the header
480489
curl_authorization=( "--config" "$curl_authorization_header_file" )
481490

482-
483491
# Define test files and directories
484492
dirname="integration_test"
485493
testfile="1GBfile"

0 commit comments

Comments
 (0)