| Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 1 | #!/usr/bin/env bash | 
 | 2 |  | 
 | 3 | # Test swift via the command line tools that ship with it. | 
 | 4 |  | 
 | 5 | # This script exits on an error so that errors don't compound and you see | 
 | 6 | # only the first error that occured. | 
 | 7 | set -o errexit | 
 | 8 |  | 
 | 9 | # Print the commands being run so that we can see the command that triggers | 
 | 10 | # an error.  It is also useful for following allowing as the install occurs. | 
 | 11 | set -o xtrace | 
 | 12 |  | 
 | 13 |  | 
 | 14 | # Settings | 
 | 15 | # ======== | 
 | 16 |  | 
 | 17 | # Use openrc + stackrc + localrc for settings | 
 | 18 | pushd $(cd $(dirname "$0")/.. && pwd) | 
 | 19 | source ./openrc | 
 | 20 | popd | 
 | 21 |  | 
 | 22 |  | 
 | 23 | # Testing Swift | 
 | 24 | # ============= | 
 | 25 |  | 
 | 26 | # Check if we have to swift via keystone | 
 | 27 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat | 
 | 28 |  | 
 | 29 | # We start by creating a test container | 
 | 30 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer | 
 | 31 |  | 
 | 32 | # add some files into it. | 
 | 33 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue | 
 | 34 |  | 
 | 35 | # list them | 
 | 36 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer | 
 | 37 |  | 
 | 38 | # And we may want to delete them now that we have tested that | 
 | 39 | # everything works. | 
 | 40 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer |