blob: 76096379a4e652df4aa5d8b7d74dbf8a0def33f0 [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
Dean Troyer489bd2a2012-03-02 10:44:29 -06005echo "**************************************************"
6echo "Begin DevStack Exercise: $0"
7echo "**************************************************"
8
Todd Willey3e6ec232011-11-04 12:23:35 -04009# This script exits on an error so that errors don't compound and you see
10# only the first error that occured.
11set -o errexit
12
13# Print the commands being run so that we can see the command that triggers
14# an error. It is also useful for following allowing as the install occurs.
15set -o xtrace
16
17
18# Settings
19# ========
20
21# Use openrc + stackrc + localrc for settings
Dean Troyer489bd2a2012-03-02 10:44:29 -060022pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null
23
24# Import common functions
25source ./functions
26
27# Import configuration
Todd Willey3e6ec232011-11-04 12:23:35 -040028source ./openrc
Dean Troyer489bd2a2012-03-02 10:44:29 -060029popd >/dev/null
30
31# Container name
32CONTAINER=ex-swift
Todd Willey3e6ec232011-11-04 12:23:35 -040033
34
35# Testing Swift
36# =============
37
38# Check if we have to swift via keystone
Chmouel Boudjnaha6bdfdd2012-02-29 14:11:01 +000039swift stat
Dean Troyer489bd2a2012-03-02 10:44:29 -060040die_if_error "Failure geting status"
Todd Willey3e6ec232011-11-04 12:23:35 -040041
42# We start by creating a test container
Dean Troyer489bd2a2012-03-02 10:44:29 -060043swift post $CONTAINER
44die_if_error "Failure creating container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040045
46# add some files into it.
Dean Troyer489bd2a2012-03-02 10:44:29 -060047swift upload $CONTAINER /etc/issue
48die_if_error "Failure uploading file to container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040049
50# list them
Dean Troyer489bd2a2012-03-02 10:44:29 -060051swift list $CONTAINER
52die_if_error "Failure listing contents of container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040053
54# And we may want to delete them now that we have tested that
55# everything works.
Dean Troyer489bd2a2012-03-02 10:44:29 -060056swift delete $CONTAINER
57die_if_error "Failure deleting container $CONTAINER"
58
59set +o xtrace
60echo "**************************************************"
61echo "End DevStack Exercise: $0"
62echo "**************************************************"