Skip to content

Commit

Permalink
Permits updating existing queues with different configs. (#318)
Browse files Browse the repository at this point in the history
Removes find method no longer used.
  • Loading branch information
rubendebest authored May 15, 2023
1 parent 18f2b82 commit 159ac5e
Show file tree
Hide file tree
Showing 11 changed files with 1,025 additions and 506 deletions.
15 changes: 9 additions & 6 deletions lib/aws/sqs/configurator/queue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ def initialize(options)
end

def create!(client)
client.aws.create_queue(queue_name: @name_formatted, attributes: @attributes)
.tap { subscribe_in_topics!(client) if @topics.any? }
queue = client.aws.create_queue(queue_name: @name_formatted, attributes: @attributes.slice(*fifo_params))
.tap { subscribe_in_topics!(client) if @topics.any? }
client.aws.set_queue_attributes(queue_url: queue.queue_url, attributes: @attributes.except(*fifo_params))
queue
end

def find!(client)
client.aws.get_queue_url(queue_name: @name_formatted)
rescue Aws::SQS::Errors::NonExistentQueue
false
def fifo_params
%i[
FifoQueue
ContentBasedDeduplication
]
end

private
Expand Down
21 changes: 0 additions & 21 deletions spec/aws/sqs/configurator/queue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,4 @@
end
end
end

describe '#find!' do
let(:client) { build :client }
subject { queue.find!(client) }

context 'with unknown queue' do
let(:queue) { described_class.new(name: 'unknown_queue', region: 'us-east-1') }

it 'shouldnt find the queue', :vcr do
is_expected.to be_falsey
end
end

context 'with known queue' do
let(:queue) { described_class.new(name: 'standard_queue', region: 'us-east-1') }

it 'should find the queue', :vcr do
expect(subject.queue_url).to include("#{ENV['AWS_ACCOUNT_ID']}/standard_queue")
end
end
end
end

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 159ac5e

Please sign in to comment.