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