From 3e6ec236f01abaf80fe7dc8db73ecbfdf3532e89 Mon Sep 17 00:00:00 2001
From: Todd Willey <xtoddx@gmail.com>
Date: Fri, 4 Nov 2011 12:23:35 -0400
Subject: [PATCH] Pull in swift testing from master.

---
 exercises/swift.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 exercises/swift.sh

diff --git a/exercises/swift.sh b/exercises/swift.sh
new file mode 100644
index 0000000000..f7be099445
--- /dev/null
+++ b/exercises/swift.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+# Test swift via the command line tools that ship with it.
+
+# This script exits on an error so that errors don't compound and you see
+# only the first error that occured.
+set -o errexit
+
+# Print the commands being run so that we can see the command that triggers
+# an error.  It is also useful for following allowing as the install occurs.
+set -o xtrace
+
+
+# Settings
+# ========
+
+# Use openrc + stackrc + localrc for settings
+pushd $(cd $(dirname "$0")/.. && pwd)
+source ./openrc
+popd
+
+
+# Testing Swift
+# =============
+
+# Check if we have to swift via keystone
+swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat
+
+# We start by creating a test container
+swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer
+
+# add some files into it.
+swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue
+
+# list them
+swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer
+
+# And we may want to delete them now that we have tested that
+# everything works.
+swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer