b7e85d5282
Swift is a major OpenStack project. It could use testing upgrades. New jobs are placed in the experimental pipeline to avoid excessive CI load on general changes. Change-Id: I8a089fdd1f21eb4c3e00c38ea9dfcecc77565bf5 Related-Bug: #1874691
72 lines
1.4 KiB
Bash
Executable File
72 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o xtrace
|
|
set -o errexit
|
|
|
|
export PYTHONUNBUFFERED=1
|
|
|
|
|
|
function test_swift_logged {
|
|
. /etc/kolla/admin-openrc.sh
|
|
. ~/openstackclient-venv/bin/activate
|
|
|
|
echo "TESTING: Swift"
|
|
|
|
CONTAINER_NAME=test_container
|
|
|
|
openstack --debug container create $CONTAINER_NAME
|
|
|
|
CONTENT='Hello, Swift!'
|
|
FILE_PATH=/tmp/swift_test_object
|
|
|
|
echo "$CONTENT" > $FILE_PATH
|
|
|
|
openstack --debug object create $CONTAINER_NAME $FILE_PATH
|
|
|
|
rm -f $FILE_PATH
|
|
|
|
openstack --debug object save $CONTAINER_NAME $FILE_PATH
|
|
|
|
SAVED_CONTENT=`cat $FILE_PATH`
|
|
|
|
rm -f $FILE_PATH
|
|
|
|
if [ "$SAVED_CONTENT" != "$CONTENT" ]; then
|
|
echo 'Content mismatch' >&2
|
|
return 1
|
|
fi
|
|
|
|
openstack --debug container show $CONTAINER_NAME
|
|
|
|
openstack --debug object store account show
|
|
|
|
cleanup_swift
|
|
|
|
echo "SUCCESS: Swift"
|
|
}
|
|
|
|
function cleanup_swift {
|
|
openstack --debug object delete $CONTAINER_NAME $FILE_PATH
|
|
|
|
openstack --debug container delete $CONTAINER_NAME
|
|
}
|
|
|
|
function test_swift {
|
|
echo "Testing Swift"
|
|
log_file=/tmp/logs/ansible/test-swift
|
|
if [[ -f $log_file ]]; then
|
|
log_file=${log_file}-upgrade
|
|
fi
|
|
test_swift_logged > $log_file 2>&1
|
|
result=$?
|
|
if [[ $result != 0 ]]; then
|
|
echo "Testing Swift failed. See ansible/test-swift for details"
|
|
else
|
|
echo "Successfully tested Swift. See ansible/test-swift for details"
|
|
fi
|
|
return $result
|
|
}
|
|
|
|
|
|
test_swift
|