Merge "[CEPH] Expand the Keystone Helm tests for RGW"

This commit is contained in:
Zuul
2019-02-07 19:11:42 +00:00
committed by Gerrit Code Review

View File

@@ -28,22 +28,54 @@ function rgw_keystone_bucket_validation ()
echo "--> creating openstack_test_container container" echo "--> creating openstack_test_container container"
openstack container create 'openstack_test_container' openstack container create 'openstack_test_container'
echo "--> rgw bucket list" echo "--> list containers"
radosgw-admin bucket list openstack container list
all_buckets_stats=$(radosgw-admin bucket stats --format json) bucket_stat=$(openstack container list | grep "openstack_test_container")
bucket_stat=$(echo $all_buckets_stats | jq -c '.[] | select(.bucket | contains("openstack_test_container"))')
if [[ -z ${bucket_stat} ]]; then if [[ -z ${bucket_stat} ]]; then
echo "--> rgw bucket openstack_test_container not found" echo "--> container openstack_test_container not found"
exit 1 exit 1
else else
echo "--> rgw bucket openstack_test_container found" echo "--> container openstack_test_container found"
echo "Hello world!" | tee /tmp/hello.txt
echo "--> file uploaded to openstack_test_container container"
openstack object create --name hello openstack_test_container /tmp/hello.txt
echo "--> list contents of openstack_test_container container"
openstack object list openstack_test_container
echo "--> download object from openstack_test_container container"
openstack object save --file /tmp/output.txt openstack_test_container hello
if [ $? -ne 0 ]; then
echo "Error during openstack CLI execution"
exit 1
else
echo "File downloaded from container"
fi
content=$(cat /tmp/output.txt)
if [ "Hello world!" == "${content}" ]; then
echo "Content matches from downloaded file using openstack CLI"
else
echo "Content is mismatched from downloaded file using openstack CLI"
exit 1
fi
echo "--> deleting object from openstack_test_container container"
openstack object delete openstack_test_container hello
if [ $? -ne 0 ]; then
echo "Error during openstack CLI execution"
exit 1
else
echo "File from container is deleted"
fi
echo "--> deleting openstack_test_container container" echo "--> deleting openstack_test_container container"
openstack container delete openstack_test_container openstack container delete openstack_test_container
echo "--> bucket list after deleting container" echo "--> bucket list after deleting container"
radosgw-admin bucket list openstack container list
fi fi
} }
@@ -58,7 +90,7 @@ function rgw_s3_bucket_validation ()
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Bucket $bucket created" echo "Bucket $bucket created"
echo "Hello world!" > /tmp/hello.txt echo "Hello world!" | tee /tmp/hello.txt
s3cmd put /tmp/hello.txt $bucket --host=$RGW_HOST --host-bucket=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-ssl s3cmd put /tmp/hello.txt $bucket --host=$RGW_HOST --host-bucket=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-ssl
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@@ -77,9 +109,11 @@ function rgw_s3_bucket_validation ()
fi fi
content=$(cat /tmp/output.txt) content=$(cat /tmp/output.txt)
echo $content if [ "Hello world!" == "${content}" ]; then
if [ "Hello" == "${content}" ]; then
echo "Content matches from downloaded file using s3cmd" echo "Content matches from downloaded file using s3cmd"
else
echo "Content is mismatched from downloaded file using s3cmd"
exit 1
fi fi
s3cmd ls $bucket --host=$RGW_HOST --host-bucket=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-ssl s3cmd ls $bucket --host=$RGW_HOST --host-bucket=$RGW_HOST --access_key=$S3_ADMIN_ACCESS_KEY --secret_key=$S3_ADMIN_SECRET_KEY --no-ssl