1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Accept stringy values for -i (like -i worker.1)

This commit is contained in:
Jacob Elder 2013-04-24 14:48:22 -04:00
parent 3eb6ad457c
commit 3e0a5ea8d7
2 changed files with 6 additions and 1 deletions

View file

@ -248,7 +248,7 @@ module Sidekiq
end
o.on '-i', '--index INT', "unique process index on this machine" do |arg|
opts[:index] = Integer(arg)
opts[:index] = Integer(arg.match(/\d+/)[0])
end
o.on '-p', '--profile', "Profile all code run by Sidekiq" do |arg|

View file

@ -45,6 +45,11 @@ class TestCli < MiniTest::Unit::TestCase
assert_equal 7, Sidekiq.options[:index]
end
it 'accepts a stringy process index' do
@cli.parse(['sidekiq', '-i', 'worker.7', '-r', './test/fake_env.rb'])
assert_equal 7, Sidekiq.options[:index]
end
it 'sets strictly ordered queues if weights are not present' do
@cli.parse(['sidekiq', '-q', 'foo,bar', '-r', './test/fake_env.rb'])
assert_equal true, !!Sidekiq.options[:strict]