Permalink
Browse files

Remove "clear worker list" button, more UI testing

  • Loading branch information...
1 parent a23ac4f commit a69c657378416ec5994a43f8617adf142d21e2b7 @mperham committed May 5, 2012
Showing with 22 additions and 16 deletions.
  1. +0 −14 lib/sidekiq/web.rb
  2. +1 −0 test/helper.rb
  3. +21 −0 test/test_web.rb
  4. +0 −2 web/views/index.slim
View
@@ -38,15 +38,6 @@ class Web < Sinatra::Base
helpers do
- def reset_worker_list
- Sidekiq.redis do |conn|
- workers = conn.smembers('workers')
- workers.each do |name|
- conn.srem('workers', name)
- end
- end
- end
-
def workers
@workers ||= begin
Sidekiq.redis do |conn|
@@ -114,11 +105,6 @@ def relative_time(time)
slim :index
end
- post "/reset" do
- reset_worker_list
- redirect root_path
- end
-
get "/queues/:name" do
halt 404 unless params[:name]
@name = params[:name]
View
@@ -1,3 +1,4 @@
+ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test'
if ENV.has_key?("SIMPLECOV")
require 'simplecov'
SimpleCov.start
View
@@ -52,10 +52,31 @@ def perform(a, b)
assert_equal 404, last_response.status
end
+ it 'handles missing retry' do
+ get '/retries/12391982.123'
+ assert_equal 302, last_response.status
+ end
+
it 'handles queue view' do
get '/queues/default'
assert_equal 200, last_response.status
end
+ it 'can delete a queue' do
+ Sidekiq.redis do |conn|
+ conn.rpush('queue:foo', '{}')
+ conn.sadd('queues', 'foo')
+ end
+
+ get '/queues/foo'
+ assert_equal 200, last_response.status
+
+ post '/queues/foo'
+ assert_equal 302, last_response.status
+
+ Sidekiq.redis do |conn|
+ refute conn.smembers('queues').include?('foo')
+ end
+ end
end
end
@@ -30,8 +30,6 @@
td= msg['payload']['class']
td= msg['payload']['args'].inspect[0..100]
td== relative_time(Time.parse(msg['run_at']))
- form action="#{root_path}reset" method="post"
- button.btn type="submit" Clear worker list
#queues.tab-pane
table class="table table-striped table-bordered"

0 comments on commit a69c657

Please sign in to comment.