4 # S3_ACCESS_KEY_ID - must be set to S3 Access Key ID
5 # S3_SECRET_ACCESS_KEY - must be set to S3 Secret Access Key
6 # TEST_BUCKET_PREFIX - must be set to the test bucket prefix to use
7 # S3_COMMAND - may be set to s3 command to use (i.e. valgrind s3); defaults
10 if [ -z "$S3_ACCESS_KEY_ID" ]; then
11 echo "S3_ACCESS_KEY_ID required"
15 if [ -z "$S3_SECRET_ACCESS_KEY" ]; then
16 echo "S3_SECRET_ACCESS_KEY required"
20 if [ -z "$TEST_BUCKET_PREFIX" ]; then
21 echo "TEST_BUCKET_PREFIX required"
25 if [ -z "$S3_COMMAND" ]; then
29 TEST_BUCKET=${TEST_BUCKET_PREFIX}.testbucket
31 # Create the test bucket in EU
32 echo "$S3_COMMAND create $TEST_BUCKET locationConstraint=EU"
33 $S3_COMMAND create $TEST_BUCKET
36 echo "$S3_COMMAND list | grep $TEST_BUCKET"
37 $S3_COMMAND list | grep $TEST_BUCKET
40 echo "$S3_COMMAND test $TEST_BUCKET"
41 $S3_COMMAND test $TEST_BUCKET
43 # List to ensure that it is empty
44 echo "$S3_COMMAND list $TEST_BUCKET"
45 $S3_COMMAND list $TEST_BUCKET
50 echo "$S3_COMMAND put $TEST_BUCKET/testkey filename=seqdata noStatus=1"
51 $S3_COMMAND put $TEST_BUCKET/testkey filename=seqdata noStatus=1
54 # Get the data and make sure that it matches
55 echo "$S3_COMMAND get $TEST_BUCKET/testkey filename=testkey"
56 $S3_COMMAND get $TEST_BUCKET/testkey filename=testkey
61 echo "$S3_COMMAND delete $TEST_BUCKET/testkey"
62 $S3_COMMAND delete $TEST_BUCKET/testkey
64 # Remove the test bucket
65 echo "$S3_COMMAND delete $TEST_BUCKET"
66 $S3_COMMAND delete $TEST_BUCKET
68 # Make sure it's not there
69 echo "$S3_COMMAND list | grep $TEST_BUCKET"
70 $S3_COMMAND list | grep $TEST_BUCKET
73 echo "$S3_COMMAND create $TEST_BUCKET"
74 $S3_COMMAND create $TEST_BUCKET
77 for i in `seq 0 9`; do
78 echo "echo \"Hello\" | $S3_COMMAND put $TEST_BUCKET/key_$i"
79 echo "Hello" | $S3_COMMAND put $TEST_BUCKET/key_$i
82 # List with all details
83 echo "$S3_COMMAND list $TEST_BUCKET allDetails=1"
84 $S3_COMMAND list $TEST_BUCKET allDetails=1
86 COPY_BUCKET=${TEST_BUCKET_PREFIX}.copybucket
88 # Create another test bucket and copy a file into it
89 echo "$S3_COMMAND create $COPY_BUCKET"
90 $S3_COMMAND create $COPY_BUCKET
92 $S3_COMMAND copy $TEST_BUCKET/key_5 $COPY_BUCKET/copykey
94 $S3_COMMAND copy $TEST_BUCKET/key_5 $COPY_BUCKET/copykey
96 # List the copy bucket
97 echo "$S3_COMMAND list $COPY_BUCKET allDetails=1"
98 $S3_COMMAND list $COPY_BUCKET allDetails=1
102 echo "$S3_COMMAND get $TEST_BUCKET/key_5 filename=key_5"
103 $S3_COMMAND get $TEST_BUCKET/key_5 filename=key_5
104 echo "$S3_COMMAND get $COPY_BUCKET/copykey filename=copykey"
105 $S3_COMMAND get $COPY_BUCKET/copykey filename=copykey
110 for i in `seq 0 9`; do
111 echo "$S3_COMMAND delete $TEST_BUCKET/key_$i"
112 $S3_COMMAND delete $TEST_BUCKET/key_$i
114 echo "$S3_COMMAND delete $COPY_BUCKET/copykey"
115 $S3_COMMAND delete $COPY_BUCKET/copykey
117 # Delete the copy bucket
118 echo "$S3_COMMAND delete $COPY_BUCKET"
119 $S3_COMMAND delete $COPY_BUCKET
121 # Now create a new zero-length file
122 echo "$S3_COMMAND put $TEST_BUCKET/aclkey < /dev/null"
123 $S3_COMMAND put $TEST_BUCKET/aclkey < /dev/null
127 echo "$S3_COMMAND getacl $TEST_BUCKET filename=acl allDetails=1"
128 $S3_COMMAND getacl $TEST_BUCKET filename=acl allDetails=1
130 # Add READ for all AWS users, and READ_ACP for everyone
132 Group Authenticated AWS Users READ
135 Group All Users READ_ACP
137 echo "$S3_COMMAND setacl $TEST_BUCKET filename=acl"
138 $S3_COMMAND setacl $TEST_BUCKET filename=acl
140 # Test to make sure that it worked
142 echo "$S3_COMMAND getacl $TEST_BUCKET filename=acl_new allDetails=1"
143 $S3_COMMAND getacl $TEST_BUCKET filename=acl_new allDetails=1
149 echo "$S3_COMMAND getacl $TEST_BUCKET/aclkey filename=acl allDetails=1"
150 $S3_COMMAND getacl $TEST_BUCKET/aclkey filename=acl allDetails=1
152 # Add READ for all AWS users, and READ_ACP for everyone
154 Group Authenticated AWS Users READ
157 Group All Users READ_ACP
159 echo "$S3_COMMAND setacl $TEST_BUCKET/aclkey filename=acl"
160 $S3_COMMAND setacl $TEST_BUCKET/aclkey filename=acl
162 # Test to make sure that it worked
164 echo "$S3_COMMAND getacl $TEST_BUCKET/aclkey filename=acl_new allDetails=1"
165 $S3_COMMAND getacl $TEST_BUCKET/aclkey filename=acl_new allDetails=1
169 # Remove the test file
170 echo "$S3_COMMAND delete $TEST_BUCKET/aclkey"
171 $S3_COMMAND delete $TEST_BUCKET/aclkey
172 echo "$S3_COMMAND delete $TEST_BUCKET"
173 $S3_COMMAND delete $TEST_BUCKET