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 | |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 26 | # FIXME(chmou): when review https://review.openstack.org/#change,3712 |
| 27 | # is merged we would be able to use the common openstack options and |
| 28 | # remove the trailing slash to v2.0 auth url. |
| 29 | # |
Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 30 | # Check if we have to swift via keystone |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 31 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD stat |
Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 32 | |
| 33 | # We start by creating a test container |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 34 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD post testcontainer |
Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 35 | |
| 36 | # add some files into it. |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 37 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue |
Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 38 | |
| 39 | # list them |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 40 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD list testcontainer |
Todd Willey | 3e6ec23 | 2011-11-04 12:23:35 -0400 | [diff] [blame] | 41 | |
| 42 | # And we may want to delete them now that we have tested that |
| 43 | # everything works. |
Chmouel Boudjnah | 8534bcb | 2012-02-25 08:04:48 +0000 | [diff] [blame^] | 44 | swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD delete testcontainer |