Skip to content

Commit

Permalink
[api] really test delayed jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Sep 7, 2013
1 parent 8ad6479 commit c37b728
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ GEM
rdoc (4.0.1)
json (~> 1.4)
riddle (1.5.8)
ruby-ldap (0.9.13)
ruby-ldap (0.9.16)
ruby_parser (3.2.2)
sexp_processor (~> 4.1)
safe_yaml (0.9.5)
Expand Down
10 changes: 10 additions & 0 deletions src/api/test/functional/issue_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
class IssueControllerTest < ActionDispatch::IntegrationTest
fixtures :all

def setup
stub_request(:post, "http://bugzilla.novell.com/xmlrpc.cgi").to_timeout
super
end

def teardown
WebMock.reset!
super
end

def test_get_issues
# bugs are public atm. Secret stuff should not get imported.
get '/issue_trackers'
Expand Down
2 changes: 2 additions & 0 deletions src/api/test/functional/maintenance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ class MaintenanceTests < ActionDispatch::IntegrationTest
def setup
super
wait_for_scheduler_start
stub_request(:post, "http://bugzilla.novell.com/xmlrpc.cgi").to_timeout
end

teardown do
WebMock.reset!
Timecop.return
end

Expand Down
6 changes: 5 additions & 1 deletion src/api/test/functional/release_management_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ class ReleaseManagementTests < ActionDispatch::IntegrationTest
def test_release_project
prepare_request_with_user "tom", "thunder"

# inject a job for copy any entire project ... gets not executed in test suite
# inject a job for copy any entire project ... gets copied in testsuite but appears to be delayed
post "/source/home:tom:BaseDistro", :cmd => :copy, :oproject => "BaseDistro"
assert_response :success
assert_xml_tag( :tag => "status", :attributes => { :code => "invoked"} )

# cleanup
delete "/source/home:tom:BaseDistro"
assert_response :success

# copy any entire project NOW
post "/source/home:tom:BaseDistro", :cmd => :copy, :oproject => "BaseDistro", :nodelay => 1
assert_response :success
Expand Down
2 changes: 0 additions & 2 deletions src/api/test/models/event_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class EventTest < ActiveSupport::TestCase

teardown do
WebMock.reset!
Delayed::Worker.delay_jobs = true
end

test "find nothing" do
Expand Down Expand Up @@ -36,7 +35,6 @@ class EventTest < ActiveSupport::TestCase
end

test "sent all" do
Delayed::Worker.delay_jobs = false
Event::NotifyBackends.trigger_delayed_sent
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/test/unit/issue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class IssueTest < ActiveSupport::TestCase
fixtures :all

def teardown
teardown do
WebMock.reset!
end

Expand Down
2 changes: 2 additions & 0 deletions src/api/test/unit/package_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ class PackageTest < ActiveSupport::TestCase
fixtures :all

def setup
super
@package = Package.find( 10095 )
end

def teardown
Timecop.return
super
end

def test_flags_to_axml
Expand Down

0 comments on commit c37b728

Please sign in to comment.