aws-sdk-core 2.0.0.rc4 → 2.0.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apis/CloudFront-2013-11-11.json +5502 -0
- data/apis/CloudWatch-2010-08-01.json +186 -1
- data/apis/DirectConnect-2012-10-25.json +758 -140
- data/apis/DynamoDB-2012-08-10.json +860 -2
- data/apis/EC2-2013-10-15.json +14698 -0
- data/apis/EMR-2009-03-31.json +86 -0
- data/apis/ElastiCache-2013-06-15.json +13 -5
- data/apis/ElasticBeanstalk-2010-12-01.json +141 -16
- data/apis/ElasticLoadBalancing-2012-06-01.json +0 -72
- data/apis/IAM-2010-05-08.json +156 -0
- data/apis/Kinesis-2013-12-02.json +9 -1
- data/apis/OpsWorks-2013-02-18.json +180 -6
- data/apis/RDS-2013-02-12.json +2 -1
- data/apis/RDS-2013-09-09.json +7963 -0
- data/apis/Redshift-2012-12-01.json +3273 -702
- data/apis/Route53-2012-12-12.json +2 -2
- data/apis/S3-2006-03-01.json +579 -538
- data/apis/SNS-2010-03-31.json +14 -0
- data/apis/SQS-2012-11-05.json +43 -6
- data/apis/STS-2011-06-15.json +81 -0
- data/apis/StorageGateway-2013-06-30.json +28 -28
- data/apis/source/cloudformation-2010-05-15.json +199 -199
- data/apis/source/cloudfront-2013-11-11.json +8828 -0
- data/apis/source/cloudfront-2013-11-11.paginators.json +32 -0
- data/apis/source/cloudfront-2013-11-11.waiters.json +29 -0
- data/apis/source/cloudsearch-2011-02-01.json +16 -23
- data/apis/source/datapipeline-2012-10-29.paginators.json +3 -2
- data/apis/source/directconnect-2012-10-25.json +1302 -363
- data/apis/source/dynamodb-2011-12-05.paginators.json +4 -1
- data/apis/source/dynamodb-2011-12-05.waiters.json +27 -0
- data/apis/source/dynamodb-2012-08-10.json +1634 -417
- data/apis/source/dynamodb-2012-08-10.paginators.json +4 -1
- data/apis/source/dynamodb-2012-08-10.waiters.json +25 -0
- data/apis/source/ec2-2013-10-15.json +19911 -0
- data/apis/source/ec2-2013-10-15.paginators.json +126 -0
- data/apis/source/ec2-2013-10-15.waiters.json +146 -0
- data/apis/source/elasticache-2013-06-15.json +10 -8
- data/apis/source/elasticache-2013-06-15.paginators.json +8 -2
- data/apis/source/elasticbeanstalk-2010-12-01.json +186 -32
- data/apis/source/elasticloadbalancing-2012-06-01.json +166 -293
- data/apis/source/elasticmapreduce-2009-03-31.json +229 -134
- data/apis/source/elastictranscoder-2012-09-25.json +1 -1
- data/apis/source/glacier-2012-06-01.paginators.json +3 -3
- data/apis/source/glacier-2012-06-01.waiters.json +23 -0
- data/apis/source/iam-2010-05-08.json +1306 -626
- data/apis/source/iam-2010-05-08.paginators.json +3 -0
- data/apis/source/kinesis-2013-12-02.json +4 -4
- data/apis/source/kinesis-2013-12-02.paginators.json +10 -4
- data/apis/source/monitoring-2010-08-01.json +336 -28
- data/apis/source/opsworks-2013-02-18.json +385 -102
- data/apis/source/rds-2013-01-10.paginators.json +6 -2
- data/apis/source/rds-2013-02-12.paginators.json +6 -2
- data/apis/source/rds-2013-09-09.json +10658 -0
- data/apis/source/rds-2013-09-09.paginators.json +110 -0
- data/apis/source/rds-2013-09-09.waiters.json +36 -0
- data/apis/source/redshift-2012-12-01.json +4759 -1237
- data/apis/source/redshift-2012-12-01.paginators.json +20 -1
- data/apis/source/redshift-2012-12-01.waiters.json +43 -0
- data/apis/source/route53-2012-12-12.paginators.json +2 -2
- data/apis/source/s3-2006-03-01.json +1032 -985
- data/apis/source/s3-2006-03-01.paginators.json +14 -3
- data/apis/source/s3-2006-03-01.waiters.json +27 -0
- data/apis/source/sns-2010-03-31.paginators.json +10 -0
- data/apis/source/sqs-2012-11-05.json +153 -101
- data/apis/source/storagegateway-2013-06-30.json +403 -442
- data/apis/source/storagegateway-2013-06-30.paginators.json +24 -0
- data/apis/source/sts-2011-06-15.json +258 -75
- data/apis/source/support-2013-04-15.paginators.json +0 -6
- data/apis/source/swf-2012-01-25.paginators.json +7 -7
- data/features/autoscaling/client.feature +6 -10
- data/features/autoscaling/{setup.rb → step_definitions.rb} +1 -1
- data/features/cloudformation/client.feature +5 -6
- data/features/cloudformation/{setup.rb → step_definitions.rb} +1 -1
- data/features/cloudfront/client.feature +5 -9
- data/features/cloudfront/{setup.rb → step_definitions.rb} +1 -1
- data/features/cloudsearch/client.feature +4 -6
- data/features/cloudsearch/{setup.rb → step_definitions.rb} +1 -1
- data/features/cloudwatch/client.feature +7 -9
- data/features/cloudwatch/{setup.rb → step_definitions.rb} +1 -1
- data/features/datapipeline/client.feature +5 -7
- data/features/datapipeline/{setup.rb → step_definitions.rb} +1 -1
- data/features/directconnect/client.feature +5 -7
- data/features/directconnect/{setup.rb → step_definitions.rb} +1 -1
- data/features/dynamodb/client.feature +6 -10
- data/features/dynamodb/simplified.feature +5 -9
- data/features/dynamodb/step_definitions.rb +9 -1
- data/features/ec2/client.feature +4 -9
- data/features/ec2/step_definitions.rb +3 -16
- data/features/elasticache/client.feature +4 -6
- data/features/elasticache/{setup.rb → step_definitions.rb} +1 -1
- data/features/elasticbeanstalk/client.feature +4 -6
- data/features/elasticbeanstalk/{setup.rb → step_definitions.rb} +1 -1
- data/features/elasticloadbalancing/client.feature +4 -6
- data/features/elasticloadbalancing/{setup.rb → step_definitions.rb} +1 -1
- data/features/elastictranscoder/client.feature +4 -6
- data/features/elastictranscoder/{setup.rb → step_definitions.rb} +1 -1
- data/features/emr/client.feature +4 -6
- data/features/emr/{setup.rb → step_definitions.rb} +1 -1
- data/features/env.rb +0 -2
- data/features/glacier/client.feature +10 -34
- data/features/glacier/step_definitions.rb +25 -8
- data/features/glacier/upload.feature +27 -0
- data/features/iam/client.feature +4 -6
- data/features/iam/{setup.rb → step_definitions.rb} +1 -1
- data/features/importexport/client.feature +4 -6
- data/features/importexport/{setup.rb → step_definitions.rb} +1 -1
- data/features/kinesis/client.feature +4 -6
- data/features/kinesis/{setup.rb → step_definitions.rb} +1 -1
- data/features/opsworks/client.feature +4 -6
- data/features/opsworks/{setup.rb → step_definitions.rb} +1 -1
- data/features/rds/client.feature +4 -6
- data/features/rds/{setup.rb → step_definitions.rb} +1 -1
- data/features/redshift/client.feature +4 -6
- data/features/redshift/{setup.rb → step_definitions.rb} +1 -1
- data/features/route53/client.feature +4 -6
- data/features/route53/{setup.rb → step_definitions.rb} +1 -1
- data/features/s3/buckets.feature +8 -0
- data/features/s3/step_definitions.rb +42 -3
- data/features/sdb/client.feature +4 -6
- data/features/sdb/{setup.rb → step_definitions.rb} +1 -1
- data/features/ses/client.feature +4 -6
- data/features/ses/{setup.rb → step_definitions.rb} +1 -1
- data/features/sns/client.feature +5 -6
- data/features/sns/{setup.rb → step_definitions.rb} +1 -1
- data/features/sqs/client.feature +5 -7
- data/features/sqs/step_definitions.rb +11 -0
- data/features/step_definitions.rb +88 -0
- data/features/storagegateway/client.feature +4 -6
- data/features/storagegateway/{setup.rb → step_definitions.rb} +1 -1
- data/features/sts/client.feature +5 -6
- data/features/sts/{setup.rb → step_definitions.rb} +1 -1
- data/features/swf/client.feature +5 -9
- data/features/swf/{setup.rb → step_definitions.rb} +1 -1
- data/lib/aws/api/shape_translator.rb +1 -0
- data/lib/aws/errors.rb +35 -11
- data/lib/aws/plugins/credentials.rb +11 -5
- data/lib/aws/plugins/regional_endpoint.rb +7 -3
- data/lib/aws/plugins/s3_regional_endpoint.rb +0 -2
- data/lib/aws/request_handler.rb +8 -3
- data/lib/aws/signers/s3.rb +14 -18
- data/lib/aws/version.rb +1 -1
- data/spec/aws/errors_spec.rb +39 -0
- data/spec/aws/plugins/credentials_spec.rb +12 -0
- data/spec/aws/plugins/region_endpoint_spec.rb +16 -4
- data/spec/aws/plugins/retry_errors_spec.rb +26 -26
- data/spec/aws/service_spec.rb +1 -1
- data/spec/fixtures/operations/route53/change_resource_record_sets.yml +18 -0
- data/tasks/test.rake +6 -18
- data/vendor/seahorse/lib/seahorse/client/http/headers.rb +20 -0
- data/vendor/seahorse/tasks/test.rake +2 -15
- metadata +77 -64
- data/features/common/step_definitions.rb +0 -63
- data/features/dynamodb/setup.rb +0 -8
- data/features/ec2/setup.rb +0 -6
- data/features/glacier/setup.rb +0 -16
- data/features/s3/setup.rb +0 -17
- data/features/sqs/setup.rb +0 -10
data/lib/aws/request_handler.rb
CHANGED
@@ -20,12 +20,17 @@ module Aws
|
|
20
20
|
|
21
21
|
def serialize_params(context)
|
22
22
|
input = context.operation.input
|
23
|
+
rules = input.payload_member
|
23
24
|
if input.payload
|
24
|
-
rules = input.payload_member
|
25
25
|
params = context.params[input.payload] || {}
|
26
26
|
else
|
27
|
-
|
28
|
-
|
27
|
+
params = {}
|
28
|
+
rules.members.keys.each do |param_name|
|
29
|
+
param_name = param_name.to_sym
|
30
|
+
if context.params.include?(param_name)
|
31
|
+
params[param_name] = context.params[param_name]
|
32
|
+
end
|
33
|
+
end
|
29
34
|
end
|
30
35
|
@serializer.serialize_params(context, rules, params)
|
31
36
|
end
|
data/lib/aws/signers/s3.rb
CHANGED
@@ -23,17 +23,19 @@ module Aws
|
|
23
23
|
def self.sign(context)
|
24
24
|
new(
|
25
25
|
context.config.credentials,
|
26
|
-
context.params
|
26
|
+
context.params,
|
27
|
+
context.config.force_path_style
|
27
28
|
).sign(context.http_request)
|
28
29
|
end
|
29
30
|
|
30
31
|
# @param [Credentials] credentials
|
31
|
-
def initialize(credentials, params)
|
32
|
+
def initialize(credentials, params, force_path_style)
|
32
33
|
@credentials = credentials
|
33
34
|
@params = Query::ParamList.new
|
34
35
|
params.each_pair do |param_name, param_value|
|
35
36
|
@params.set(param_name, param_value)
|
36
37
|
end
|
38
|
+
@force_path_style = force_path_style
|
37
39
|
end
|
38
40
|
|
39
41
|
attr_reader :credentials, :params
|
@@ -45,14 +47,6 @@ module Aws
|
|
45
47
|
request.headers['Authorization'] = authorization(request)
|
46
48
|
end
|
47
49
|
|
48
|
-
# @param [RequestContext] context
|
49
|
-
def self.sign(context)
|
50
|
-
new(context.config.credentials, context.params).
|
51
|
-
sign(context.http_request)
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
50
|
def authorization(request)
|
57
51
|
"AWS #{credentials.access_key_id}:#{signature(request)}"
|
58
52
|
end
|
@@ -87,7 +81,7 @@ module Aws
|
|
87
81
|
request.headers.values_at('Content-Md5', 'Content-Type').join("\n"),
|
88
82
|
signing_string_date(request),
|
89
83
|
canonicalized_headers(request),
|
90
|
-
canonicalized_resource(request),
|
84
|
+
canonicalized_resource(request.endpoint),
|
91
85
|
].flatten.compact.join("\n")
|
92
86
|
end
|
93
87
|
|
@@ -123,25 +117,27 @@ module Aws
|
|
123
117
|
# "?logging", or "?torrent"];
|
124
118
|
#
|
125
119
|
# @api private
|
126
|
-
def canonicalized_resource(
|
120
|
+
def canonicalized_resource(endpoint)
|
127
121
|
|
128
122
|
parts = []
|
129
123
|
|
130
124
|
# virtual hosted-style requests require the hostname to appear
|
131
125
|
# in the canonicalized resource prefixed by a forward slash.
|
132
126
|
if bucket = params[:bucket]
|
133
|
-
ssl =
|
134
|
-
if Plugins::S3BucketDns.dns_compatible?(bucket.value, ssl)
|
127
|
+
ssl = endpoint.https?
|
128
|
+
if Plugins::S3BucketDns.dns_compatible?(bucket.value, ssl) &&
|
129
|
+
!@force_path_style
|
130
|
+
then
|
135
131
|
parts << "/#{bucket.value}"
|
136
132
|
end
|
137
133
|
end
|
138
134
|
|
139
135
|
# append the path name (no querystring)
|
140
|
-
parts <<
|
136
|
+
parts << endpoint.path
|
141
137
|
|
142
138
|
# lastly any sub resource querystring params need to be appened
|
143
139
|
# in lexigraphical ordered joined by '&' and prefixed by '?'
|
144
|
-
params = signed_querystring_params(
|
140
|
+
params = signed_querystring_params(endpoint)
|
145
141
|
|
146
142
|
unless params.empty?
|
147
143
|
parts << '?'
|
@@ -151,8 +147,8 @@ module Aws
|
|
151
147
|
parts.join
|
152
148
|
end
|
153
149
|
|
154
|
-
def signed_querystring_params(
|
155
|
-
|
150
|
+
def signed_querystring_params(endpoint)
|
151
|
+
endpoint.querystring.to_s.split('&').select do |p|
|
156
152
|
SIGNED_QUERYSTRING_PARAMS.include?(p.split('=')[0])
|
157
153
|
end.map { |p| URI.decode(p) }
|
158
154
|
end
|
data/lib/aws/version.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Errors
|
5
|
+
describe DynamicErrors do
|
6
|
+
|
7
|
+
let(:mod) {
|
8
|
+
mod = Module.new
|
9
|
+
mod.send(:extend, DynamicErrors)
|
10
|
+
mod
|
11
|
+
}
|
12
|
+
|
13
|
+
it 'dynamically creates error classes' do
|
14
|
+
expect(mod::MyError.ancestors).to include(ServiceError)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'removes non letters and numbers from the error code' do
|
18
|
+
expect(mod.error_class('My.Error')).to be(mod::MyError)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'removes http namespaces from the error code' do
|
22
|
+
expect(mod.error_class('ErrorClass:http://foo.com')).to be(mod::ErrorClass)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'prevents #const_missing from re-setting the error constant' do
|
26
|
+
error_class = mod::FooError
|
27
|
+
expect(mod.const_missing(:FooError)).to be(error_class)
|
28
|
+
expect(mod.const_missing('FooError')).to be(error_class)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'prevents #const_missing from re-setting the error constant' do
|
32
|
+
error_class = mod::FooError
|
33
|
+
expect(mod.const_missing(:FooError)).to be(error_class)
|
34
|
+
expect(mod.const_missing('FooError')).to be(error_class)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -26,6 +26,18 @@ module Aws
|
|
26
26
|
expect(config.build!.credentials).to be(nil)
|
27
27
|
end
|
28
28
|
|
29
|
+
it 'hydrates credentials from the cmdline env (AWS_)' do
|
30
|
+
env['AWS_ACCESS_KEY'] = 'akid'
|
31
|
+
env['AWS_SECRET_KEY'] = 'secret'
|
32
|
+
env['AWS_SESSION_TOKEN'] = 'token'
|
33
|
+
plugin.add_options(config)
|
34
|
+
cfg = config.build!
|
35
|
+
expect(cfg.credentials.set?).to be(true)
|
36
|
+
expect(cfg.credentials.access_key_id).to eq('akid')
|
37
|
+
expect(cfg.credentials.secret_access_key).to eq('secret')
|
38
|
+
expect(cfg.credentials.session_token).to eq('token')
|
39
|
+
end
|
40
|
+
|
29
41
|
it 'hydrates credentials from the env (AWS_)' do
|
30
42
|
env['AWS_ACCESS_KEY_ID'] = 'akid'
|
31
43
|
env['AWS_SECRET_ACCESS_KEY'] = 'secret'
|
@@ -20,14 +20,26 @@ module Aws
|
|
20
20
|
expect(client_class.new(region: 'region').config.region).to eq('region')
|
21
21
|
end
|
22
22
|
|
23
|
-
it 'defaults to ENV["
|
24
|
-
env['
|
23
|
+
it 'defaults to ENV["AWS_DEFAULT_REGION"]' do
|
24
|
+
env['AWS_DEFAULT_REGION'] = 'env-region'
|
25
25
|
expect(client_class.new.config.region).to eq('env-region')
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'defaults to ENV["AWS_REGION"]' do
|
29
|
+
env['AWS_REGION'] = 'env-fallback1'
|
30
|
+
expect(client_class.new.config.region).to eq('env-fallback1')
|
31
|
+
end
|
32
|
+
|
28
33
|
it 'falls back to ENV["AMAZON_REGION"]' do
|
29
|
-
env['AMAZON_REGION'] = 'region-
|
30
|
-
expect(client_class.new.config.region).to eq('region-
|
34
|
+
env['AMAZON_REGION'] = 'region-fallback2'
|
35
|
+
expect(client_class.new.config.region).to eq('region-fallback2')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'prefers AWS_DEFAULT_REGION to AWS_REGION or AMAZON_REGION' do
|
39
|
+
env['AWS_DEFAULT_REGION'] = 'aws-default-region'
|
40
|
+
env['AWS_REGION'] = 'aws-region'
|
41
|
+
env['AMAZON_REGION'] = 'amazon-region'
|
42
|
+
expect(client_class.new.config.region).to eq('aws-default-region')
|
31
43
|
end
|
32
44
|
|
33
45
|
it 'prefers AWS_REGION to AMAZON_REGION' do
|
@@ -20,32 +20,32 @@ module Aws
|
|
20
20
|
describe '#expired_credentials?' do
|
21
21
|
|
22
22
|
it 'returns true if the error code is InvalidClientTokenId' do
|
23
|
-
error = IAM::Errors::InvalidClientTokenId.new
|
23
|
+
error = IAM::Errors::InvalidClientTokenId.new(nil,nil)
|
24
24
|
expect(inspector(error).expired_credentials?).to be(true)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns true if the error code is UnrecognizedClientException' do
|
28
|
-
error = SWF::Errors::UnrecognizedClientException.new
|
28
|
+
error = SWF::Errors::UnrecognizedClientException.new(nil,nil)
|
29
29
|
expect(inspector(error).expired_credentials?).to be(true)
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'returns true if the error code is InvalidAccessKeyId' do
|
33
|
-
error = S3::Errors::InvalidAccessKeyId.new
|
33
|
+
error = S3::Errors::InvalidAccessKeyId.new(nil,nil)
|
34
34
|
expect(inspector(error).expired_credentials?).to be(true)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'returns true if the error code is AuthFailure' do
|
38
|
-
error = EC2::Errors::AuthFailure.new
|
38
|
+
error = EC2::Errors::AuthFailure.new(nil,nil)
|
39
39
|
expect(inspector(error).expired_credentials?).to be(true)
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'returns true if the error code matches /expired/' do
|
43
|
-
error = IAM::Errors::SomethingExpiredError.new
|
43
|
+
error = IAM::Errors::SomethingExpiredError.new(nil,nil)
|
44
44
|
expect(inspector(error).expired_credentials?).to be(true)
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'returns false for other errors' do
|
48
|
-
error = IAM::Errors::SomeRandomError.new
|
48
|
+
error = IAM::Errors::SomeRandomError.new(nil,nil)
|
49
49
|
expect(inspector(error).expired_credentials?).to be(false)
|
50
50
|
end
|
51
51
|
|
@@ -54,42 +54,42 @@ module Aws
|
|
54
54
|
describe '#throttling_error?' do
|
55
55
|
|
56
56
|
it 'returns true for Throttling' do
|
57
|
-
error = IAM::Errors::Throttling.new
|
57
|
+
error = IAM::Errors::Throttling.new(nil,nil)
|
58
58
|
expect(inspector(error).throttling_error?).to be(true)
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'returns true for ThrottlingException' do
|
62
|
-
error = SWF::Errors::ThrottlingException.new
|
62
|
+
error = SWF::Errors::ThrottlingException.new(nil,nil)
|
63
63
|
expect(inspector(error).throttling_error?).to be(true)
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'returns true for RequestThrottled' do
|
67
|
-
error = SQS::Errors::RequestThrottled.new
|
67
|
+
error = SQS::Errors::RequestThrottled.new(nil,nil)
|
68
68
|
expect(inspector(error).throttling_error?).to be(true)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'returns true for ProvisionedThroughputExceededException' do
|
72
|
-
error = DynamoDB::Errors::ProvisionedThroughputExceededException.new
|
72
|
+
error = DynamoDB::Errors::ProvisionedThroughputExceededException.new(nil,nil)
|
73
73
|
expect(inspector(error).throttling_error?).to be(true)
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'returns true for RequestLimitExceeded' do
|
77
|
-
error = EC2::Errors::RequestLimitExceeded.new
|
77
|
+
error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
78
78
|
expect(inspector(error).throttling_error?).to be(true)
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'returns true for BandwidthLimitExceeded' do
|
82
|
-
error = CloudSearch::Errors::BandwidthLimitExceeded.new
|
82
|
+
error = CloudSearch::Errors::BandwidthLimitExceeded.new(nil,nil)
|
83
83
|
expect(inspector(error).throttling_error?).to be(true)
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'returns true for error codes that match /throttl/' do
|
87
|
-
error = IAM::Errors::Throttled.new
|
87
|
+
error = IAM::Errors::Throttled.new(nil,nil)
|
88
88
|
expect(inspector(error).throttling_error?).to be(true)
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'returns false for other errors' do
|
92
|
-
error = IAM::Errors::SomeRandomError.new
|
92
|
+
error = IAM::Errors::SomeRandomError.new(nil,nil)
|
93
93
|
expect(inspector(error).throttling_error?).to be(false)
|
94
94
|
end
|
95
95
|
|
@@ -103,7 +103,7 @@ module Aws
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'returns true if the error is a crc32 error' do
|
106
|
-
error = DynamoDB::Errors::CRC32CheckFailed.new
|
106
|
+
error = DynamoDB::Errors::CRC32CheckFailed.new(nil,nil)
|
107
107
|
expect(inspector(error).checksum?).to be(true)
|
108
108
|
end
|
109
109
|
|
@@ -117,12 +117,12 @@ module Aws
|
|
117
117
|
describe '#server?' do
|
118
118
|
|
119
119
|
it 'returns true if the error is a 500 level error' do
|
120
|
-
error = EC2::Errors::RandomError.new
|
120
|
+
error = EC2::Errors::RandomError.new(nil,nil)
|
121
121
|
expect(inspector(error, 500).server?).to be(true)
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'returns false if the error is not a 500 level error' do
|
125
|
-
error = EC2::Errors::RandomError.new
|
125
|
+
error = EC2::Errors::RandomError.new(nil,nil)
|
126
126
|
expect(inspector(error, 404).server?).to be(false)
|
127
127
|
end
|
128
128
|
|
@@ -131,7 +131,7 @@ module Aws
|
|
131
131
|
describe '#networking?' do
|
132
132
|
|
133
133
|
it 'returns true if the error code is RequestTimeout' do
|
134
|
-
error = S3::Errors::RequestTimeout.new
|
134
|
+
error = S3::Errors::RequestTimeout.new(nil,nil)
|
135
135
|
expect(inspector(error).networking?).to be(true)
|
136
136
|
end
|
137
137
|
|
@@ -188,7 +188,7 @@ module Aws
|
|
188
188
|
end
|
189
189
|
|
190
190
|
it 'reties 3 times for a total of 4 attemps' do
|
191
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
191
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
192
192
|
send_handler = double('send-handler')
|
193
193
|
expect(send_handler).to receive(:call).
|
194
194
|
exactly(4).times.
|
@@ -201,12 +201,12 @@ module Aws
|
|
201
201
|
expect(Kernel).to receive(:sleep).with(0.3).ordered
|
202
202
|
expect(Kernel).to receive(:sleep).with(0.6).ordered
|
203
203
|
expect(Kernel).to receive(:sleep).with(1.2).ordered
|
204
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
204
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
205
205
|
handle { |context| resp }
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'increments the retry count on the context' do
|
209
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
209
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
210
210
|
handle { |context| resp }
|
211
211
|
expect(resp.context.retries).to eq(3)
|
212
212
|
end
|
@@ -214,7 +214,7 @@ module Aws
|
|
214
214
|
it 'rewinds the request body before each retry attempt' do
|
215
215
|
body = resp.context.http_request.body
|
216
216
|
expect(body).to receive(:rewind).exactly(3).times
|
217
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
217
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
218
218
|
handle { |context| resp }
|
219
219
|
end
|
220
220
|
|
@@ -222,26 +222,26 @@ module Aws
|
|
222
222
|
body = double('truncatable-body', pos: 100, truncate: 0)
|
223
223
|
resp.context.http_response.body = body
|
224
224
|
expect(body).to receive(:truncate).with(0).exactly(3).times
|
225
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
225
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
226
226
|
handle { |context| resp }
|
227
227
|
end
|
228
228
|
|
229
229
|
it 'skips retry if un-truncatable response body has received data' do
|
230
230
|
resp.context.http_response.body = double('write-once-body', pos: 100)
|
231
|
-
resp.error = EC2::Errors::RequestLimitExceeded.new
|
231
|
+
resp.error = EC2::Errors::RequestLimitExceeded.new(nil,nil)
|
232
232
|
handle { |context| resp }
|
233
233
|
expect(resp.context.retries).to eq(0)
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'retries if creds expire and are refreshable' do
|
237
237
|
expect(credentials).to receive(:refresh!).exactly(3).times
|
238
|
-
resp.error = EC2::Errors::AuthFailure.new
|
238
|
+
resp.error = EC2::Errors::AuthFailure.new(nil,nil)
|
239
239
|
handle { |context| resp }
|
240
240
|
expect(resp.context.retries).to eq(3)
|
241
241
|
end
|
242
242
|
|
243
243
|
it 'skips retry if creds expire and are not refreshable' do
|
244
|
-
resp.error = EC2::Errors::AuthFailure.new
|
244
|
+
resp.error = EC2::Errors::AuthFailure.new(nil,nil)
|
245
245
|
handle { |context| resp }
|
246
246
|
expect(resp.context.retries).to eq(0)
|
247
247
|
end
|
data/spec/aws/service_spec.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Ensure that params bound for the request URI (like hosted_zone_id) do not
|
2
|
+
# end up in the XML request body
|
3
|
+
operation: change_resource_record_sets
|
4
|
+
config:
|
5
|
+
region: us-east-1
|
6
|
+
params:
|
7
|
+
:hosted_zone_id: 'ZONE-ID'
|
8
|
+
:change_batch:
|
9
|
+
:changes: []
|
10
|
+
request:
|
11
|
+
path: '/2012-12-12/hostedzone/ZONE-ID/rrset/'
|
12
|
+
body: |
|
13
|
+
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2012-12-12/">
|
14
|
+
<ChangeBatch>
|
15
|
+
<Changes>
|
16
|
+
</Changes>
|
17
|
+
</ChangeBatch>
|
18
|
+
</ChangeResourceRecordSetsRequest>
|
data/tasks/test.rake
CHANGED
@@ -1,27 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
system(cmd)
|
4
|
-
unless $?.to_i == 0
|
5
|
-
$stderr.puts "Command failed (#{$?}): #{cmd}"
|
6
|
-
exit($? >> 8)
|
7
|
-
end
|
8
|
-
end
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'cucumber/rake/task'
|
9
3
|
|
10
4
|
namespace :test do
|
11
5
|
|
12
6
|
desc "Runs unit tests"
|
13
|
-
|
14
|
-
|
15
|
-
opts += FileList[ENV['FILES'] || 'spec/**/*_spec.rb'].sort
|
16
|
-
execute_cmd(opts.join(' '))
|
7
|
+
RSpec::Core::RakeTask.new(:unit) do |t|
|
8
|
+
t.pattern = "spec"
|
17
9
|
end
|
18
10
|
|
19
|
-
|
20
|
-
|
21
|
-
tags = []
|
22
|
-
tags << "--tags ~@pending"
|
23
|
-
tags << "--tags #{ENV['TAGS']}" if ENV['TAGS']
|
24
|
-
execute_cmd("bundle exec cucumber #{tags.join(' ')}".strip)
|
11
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
12
|
+
t.cucumber_opts = "features"
|
25
13
|
end
|
26
14
|
|
27
15
|
end
|