Permalink
Browse files

Merge branch 'release/1.3' into develop

  • Loading branch information...
2 parents 4452a6e + e0aabc5 commit e34eb485ef14e2320fc27552c7445fcb95ea7e72 @ksauzz ksauzz committed Apr 8, 2013
View
@@ -53,10 +53,14 @@ distclean: clean
test: all
@./rebar skip_deps=true eunit
-test-client: test-clojure test-python test-erlang
+test-client: test-clojure test-python test-erlang test-ruby
test-python: test-boto
+test-ruby:
+ @bundle --gemfile client_tests/ruby/Gemfile --path vendor
+ @cd client_tests/ruby && bundle exec rake spec
+
test-boto:
env CS_HTTP_PORT=${CS_HTTP_PORT} python client_tests/python/boto_test.py
@@ -1,2 +1,4 @@
Gemfile.lock
conf/s3.yml
+vendor/
+.bundle/
@@ -1,8 +1,9 @@
source "https://rubygems.org"
-gem "aws-sdk", "~>1.7.1"
+gem "aws-sdk", "~>1.8.5"
gem "uuid", "~>2.3.6"
gem "rake", "~>10.0.2"
+gem "httparty", "~>0.10.2"
group :test do
gem "rspec", "~>2.11.0"
@@ -1,6 +1,5 @@
# howto run
-* edit conf/s3.yml to your RiakCS
* prepare rake
```
@@ -1,6 +0,0 @@
-s3:
- access_key_id: "your-aws-access-key-id"
- secret_access_key: "your-aws-secret-access-key"
- proxy_uri: "http://33.33.33.10:8080"
- use_ssl: false
- max_retries: 0
@@ -0,0 +1,41 @@
+require 'httparty'
+require 'json'
+require 'uuid'
+require 'tempfile'
+
+def create_user(name)
+ response = HTTParty.put("#{cs_uri}/riak-cs/user",
+ :body => {
+ :name => name,
+ :email => "#{name}@example.com"}.to_json,
+ :headers => {
+ "Content-Type" => "application/json"})
+ json_body = JSON.parse(response.body)
+ return json_body['key_id'], json_body['key_secret']
+end
+
+def s3_conf
+ key_id, key_secret = create_user(UUID::generate)
+ {
+ access_key_id: key_id,
+ secret_access_key: key_secret,
+ proxy_uri: cs_uri,
+ use_ssl: false,
+ http_read_timeout: 2000,
+ max_retries: 0
+ }
+end
+
+def cs_uri
+ "http://localhost:#{cs_port}"
+end
+
+def cs_port
+ ENV['CS_HTTP_PORT'] || 8080
+end
+
+def new_mb_temp_file(size)
+ temp = Tempfile.new 'riakcs-test'
+ (size*1024*1024).times {|i| temp.write 0}
+ temp
+end
@@ -21,6 +21,7 @@
require 'aws-sdk'
require 'uuid'
require 'yaml'
+require 'helper'
class AWS::S3::AccessControlList::Grant
def ==(other)
@@ -29,7 +30,7 @@ def ==(other)
end
describe AWS::S3 do
- let(:s3) { AWS::S3.new(YAML::load_file('conf/s3.yml')['s3']) }
+ let(:s3) { AWS::S3.new( s3_conf ) }
let(:bucket_name) { "aws-sdk-test-" + UUID::generate }
let(:object_name) { "key-" + UUID::generate }
let(:grant_public_read) {
@@ -102,5 +103,17 @@ def ==(other)
s3.buckets[bucket_name].objects[object_name].acl.grants.include?(grant_public_read).should == true
end
+
+ it "should be able to put object using multipart upload" do
+ s3.buckets.create(bucket_name).should be_kind_of(AWS::S3::Bucket)
+
+ temp = new_mb_temp_file 6 # making 6MB file
+ s3.buckets[bucket_name].objects[object_name].write(
+ :file => temp.path,
+ :multipart_threshold => 1024 * 1024,
+ )
+ s3.buckets[bucket_name].objects[object_name].exists?.should == true
+ temp.close
+ end
end
end
@@ -197,7 +197,7 @@ content_types_accepted(RD, Ctx) ->
parse_body(Body) ->
try
- {ParsedData, _Rest} = xmerl_scan:string(Body, []),
+ {ParsedData, _Rest} = xmerl_scan:string(re:replace(Body, """, "", [global, {return, list}]), []),
#xmlElement{name='CompleteMultipartUpload'} = ParsedData,
Nums = [list_to_integer(T#xmlText.value) ||
T <- xmerl_xpath:string("//CompleteMultipartUpload/Part/PartNumber/text()", ParsedData)],

0 comments on commit e34eb48

Please sign in to comment.