Skip to content

Commit

Permalink
Drop warning if region is not us-east-1 in mock
Browse files Browse the repository at this point in the history
Previously if `Fog.mock!` were used with some other region and
the bucket already existed, a warning message, `Your region <region>
does not match the default region 'us-east-1'".

We were seeing a lot of these warnings in our test suite. As far as I
can tell, there's no reason why some other region can't be used, so
drop this.
  • Loading branch information
stanhu committed Aug 7, 2024
1 parent 0e769ee commit e936356
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
4 changes: 0 additions & 4 deletions lib/fog/aws/requests/storage/put_bucket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ def put_bucket(bucket_name, options = {})
end
if !self.data[:buckets][bucket_name]
self.data[:buckets][bucket_name] = bucket
elsif self.region != 'us-east-1'
response.status = 409
Fog::Logger.warning "Your region '#{self.region}' does not match the default region 'us-east-1'"
raise(Excon::Errors.status_error({:expects => 201}, response))
end
response
end
Expand Down
10 changes: 0 additions & 10 deletions tests/requests/storage/bucket_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,6 @@
Fog::Storage[:aws].put_bucket_website('fognonbucket', 'index.html')
end

tests('put existing bucket - non-default region') do
storage_eu_endpoint = Fog::Storage[:aws]
storage_eu_endpoint.region = "eu-west-1"
storage_eu_endpoint.put_bucket(@aws_bucket_name)

tests("#put_bucket('#{@aws_bucket_name}') existing").raises(Excon::Errors::Conflict) do
storage_eu_endpoint.put_bucket(@aws_bucket_name)
end
end

tests("#put_bucket_website('fognonbucket', :RedirectAllRequestsTo => 'redirect.example.com')").raises(Excon::Errors::NotFound) do
Fog::Storage[:aws].put_bucket_website('fognonbucket', :RedirectAllRequestsTo => 'redirect.example.com')
end
Expand Down

0 comments on commit e936356

Please sign in to comment.