mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Raise real errors in mocks
This commit is contained in:
parent
f8a8172520
commit
2a26069930
10 changed files with 17 additions and 14 deletions
|
@ -32,7 +32,7 @@ module Fog
|
|||
tags = options.delete("Tags")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
stream["Tags"] = stream["Tags"].merge(tags)
|
||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
|||
stream_name = options.delete("StreamName")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
data[:kinesis_streams].delete(stream)
|
||||
|
|
|
@ -37,11 +37,11 @@ module Fog
|
|||
starting_sequence_number = (shard_iterator["StartingSequenceNumber"] || 1).to_i
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
unless shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
|
||||
raise 'unknown shard'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
|
||||
end
|
||||
|
||||
records = []
|
||||
|
|
|
@ -37,7 +37,8 @@ module Fog
|
|||
stream_name = options["StreamName"]
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
|||
stream_name = options.delete("StreamName")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
|
|
|
@ -35,15 +35,17 @@ module Fog
|
|||
adjacent_shard_to_merge_id = options.delete("AdjacentShardToMerge")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
unless shard_to_merge = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_to_merge_id }
|
||||
raise 'unknown shard'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
|
||||
|
||||
end
|
||||
|
||||
unless adjacent_shard_to_merge = stream["Shards"].detect{ |shard| shard["ShardId"] == adjacent_shard_to_merge_id }
|
||||
raise 'unknown shard'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
|
||||
|
||||
end
|
||||
|
||||
# Close shards (set an EndingSequenceNumber on them)
|
||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
|||
stream_name = options.delete("StreamName")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
sequence_number = next_sequence_number
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
def put_records(options={})
|
||||
stream_name = options.delete("StreamName")
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
records = options.delete("Records")
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
tags = options.delete("TagKeys")
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
stream["Tags"] = stream["Tags"].delete_if { |k,_| tags.include?(k) }
|
||||
|
|
|
@ -35,11 +35,11 @@ module Fog
|
|||
stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
|
||||
unless stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
|
||||
raise 'unknown stream'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Stream #{stream_name} under account #{@account_id} not found.")
|
||||
end
|
||||
|
||||
unless shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
|
||||
raise 'unknown shard'
|
||||
raise Fog::AWS::Kinesis::ResourceNotFound.new("Could not find shard foo in stream #{stream_name} under account #{@account_id}.")
|
||||
end
|
||||
|
||||
# Close original shard (set an EndingSequenceNumber on it)
|
||||
|
|
Loading…
Reference in a new issue