blob: 3a57744342ef64cc2b76ce3d2f2f7a0aa2568be0 [file] [log] [blame]
Todd Willey3e6ec232011-11-04 12:23:35 -04001#!/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.
7set -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.
11set -o xtrace
12
13
14# Settings
15# ========
16
17# Use openrc + stackrc + localrc for settings
18pushd $(cd $(dirname "$0")/.. && pwd)
19source ./openrc
20popd
21
22
23# Testing Swift
24# =============
25
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000026# 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 Willey3e6ec232011-11-04 12:23:35 -040030# Check if we have to swift via keystone
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000031swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD stat
Todd Willey3e6ec232011-11-04 12:23:35 -040032
33# We start by creating a test container
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000034swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD post testcontainer
Todd Willey3e6ec232011-11-04 12:23:35 -040035
36# add some files into it.
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000037swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue
Todd Willey3e6ec232011-11-04 12:23:35 -040038
39# list them
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000040swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD list testcontainer
Todd Willey3e6ec232011-11-04 12:23:35 -040041
42# And we may want to delete them now that we have tested that
43# everything works.
Chmouel Boudjnah8534bcb2012-02-25 08:04:48 +000044swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0/ -U admin -K $ADMIN_PASSWORD delete testcontainer