blob: b70b85f2688fdf76df660819527bf50fd6ffa188 [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
Dean Troyer51fb4542012-03-09 22:21:59 -060021# Keep track of the current directory
22EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
23TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
Dean Troyer489bd2a2012-03-02 10:44:29 -060024
25# Import common functions
Dean Troyer51fb4542012-03-09 22:21:59 -060026source $TOP_DIR/functions
Dean Troyer489bd2a2012-03-02 10:44:29 -060027
28# Import configuration
Dean Troyer51fb4542012-03-09 22:21:59 -060029source $TOP_DIR/openrc
30
31# Import exercise configuration
32source $TOP_DIR/exerciserc
Dean Troyer489bd2a2012-03-02 10:44:29 -060033
34# Container name
35CONTAINER=ex-swift
Todd Willey3e6ec232011-11-04 12:23:35 -040036
37
38# Testing Swift
39# =============
40
41# Check if we have to swift via keystone
Chmouel Boudjnaha6bdfdd2012-02-29 14:11:01 +000042swift stat
Dean Troyer489bd2a2012-03-02 10:44:29 -060043die_if_error "Failure geting status"
Todd Willey3e6ec232011-11-04 12:23:35 -040044
45# We start by creating a test container
Dean Troyer489bd2a2012-03-02 10:44:29 -060046swift post $CONTAINER
47die_if_error "Failure creating container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040048
49# add some files into it.
Dean Troyer489bd2a2012-03-02 10:44:29 -060050swift upload $CONTAINER /etc/issue
51die_if_error "Failure uploading file to container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040052
53# list them
Dean Troyer489bd2a2012-03-02 10:44:29 -060054swift list $CONTAINER
55die_if_error "Failure listing contents of container $CONTAINER"
Todd Willey3e6ec232011-11-04 12:23:35 -040056
57# And we may want to delete them now that we have tested that
58# everything works.
Dean Troyer489bd2a2012-03-02 10:44:29 -060059swift delete $CONTAINER
60die_if_error "Failure deleting container $CONTAINER"
61
62set +o xtrace
63echo "**************************************************"
64echo "End DevStack Exercise: $0"
65echo "**************************************************"