Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / workunits / rgw / run-s3tests.sh
1 #!/bin/bash -ex
2
3 # run s3-tests from current directory. assume working
4 # ceph environment (radosgw-admin in path) and rgw on localhost:8000
5 # (the vstart default).
6
7 branch=$1
8 [ -z "$1" ] && branch=master
9 port=$2
10 [ -z "$2" ] && port=8000   # this is vstart's default
11
12 ##
13
14 if [ -e CMakeCache.txt ]; then
15     BIN_PATH=$PWD/bin
16 elif [ -e $root_path/../build/CMakeCache.txt ]; then
17     cd $root_path/../build
18     BIN_PATH=$PWD/bin
19 fi
20 PATH=$PATH:$BIN_PATH
21
22 dir=tmp.s3-tests.$$
23
24 # clone and bootstrap
25 mkdir $dir
26 cd $dir
27 git clone https://github.com/ceph/s3-tests
28 cd s3-tests
29 git checkout ceph-$branch
30 VIRTUALENV_PYTHON=/usr/bin/python2 ./bootstrap
31 cd ../..
32
33 # users
34 akey1=access1
35 skey1=secret1
36 radosgw-admin user create --uid=s3test1 --display-name='tester1' \
37               --access-key=$akey1 --secret=$skey1 --email=tester1@ceph.com
38
39 akey2=access2
40 skey2=secret2
41 radosgw-admin user create --uid=s3test2 --display-name='tester2' \
42         --access-key=$akey2 --secret=$skey2 --email=tester2@ceph.com
43
44 cat <<EOF > s3.conf
45 [DEFAULT]
46 ## replace with e.g. "localhost" to run against local software
47 host = 127.0.0.1
48 ## uncomment the port to use something other than 80
49 port = $port
50 ## say "no" to disable TLS
51 is_secure = no
52 [fixtures]
53 ## all the buckets created will start with this prefix;
54 ## {random} will be filled with random characters to pad
55 ## the prefix to 30 characters long, and avoid collisions
56 bucket prefix = s3testbucket-{random}-
57 [s3 main]
58 ## the tests assume two accounts are defined, "main" and "alt".
59 ## user_id is a 64-character hexstring
60 user_id = s3test1
61 ## display name typically looks more like a unix login, "jdoe" etc
62 display_name = tester1
63 ## replace these with your access keys
64 access_key = $akey1
65 secret_key = $skey1
66 email = tester1@ceph.com
67 [s3 alt]
68 ## another user account, used for ACL-related tests
69 user_id = s3test2
70 display_name = tester2
71 ## the "alt" user needs to have email set, too
72 email = tester2@ceph.com
73 access_key = $akey2
74 secret_key = $skey2
75 EOF
76
77 S3TEST_CONF=`pwd`/s3.conf $dir/s3-tests/virtualenv/bin/nosetests -a '!fails_on_rgw' -v 
78
79 rm -rf $dir
80
81 echo OK.
82