Skip to content

Commit

Permalink
Merge pull request #15345 from matthewd/skip-dalli-errors
Browse files Browse the repository at this point in the history
Skip individual tests upon Dalli::RingError
  • Loading branch information
guilleiguaran committed May 26, 2014
2 parents 76f56c4 + 72045b2 commit de8c41c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions actionpack/test/dispatch/session/mem_cache_store_test.rb
Expand Up @@ -49,6 +49,8 @@ def test_setting_and_getting_session_value
assert_response :success assert_response :success
assert_equal 'foo: "bar"', response.body assert_equal 'foo: "bar"', response.body
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_getting_nil_session_value def test_getting_nil_session_value
Expand All @@ -57,6 +59,8 @@ def test_getting_nil_session_value
assert_response :success assert_response :success
assert_equal 'foo: nil', response.body assert_equal 'foo: nil', response.body
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_getting_session_value_after_session_reset def test_getting_session_value_after_session_reset
Expand All @@ -76,6 +80,8 @@ def test_getting_session_value_after_session_reset
assert_response :success assert_response :success
assert_equal 'foo: nil', response.body, "data for this session should have been obliterated from memcached" assert_equal 'foo: nil', response.body, "data for this session should have been obliterated from memcached"
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_getting_from_nonexistent_session def test_getting_from_nonexistent_session
Expand All @@ -85,6 +91,8 @@ def test_getting_from_nonexistent_session
assert_equal 'foo: nil', response.body assert_equal 'foo: nil', response.body
assert_nil cookies['_session_id'], "should only create session on write, not read" assert_nil cookies['_session_id'], "should only create session on write, not read"
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_setting_session_value_after_session_reset def test_setting_session_value_after_session_reset
Expand All @@ -106,6 +114,8 @@ def test_setting_session_value_after_session_reset
assert_response :success assert_response :success
assert_not_equal session_id, response.body assert_not_equal session_id, response.body
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_getting_session_id def test_getting_session_id
Expand All @@ -119,6 +129,8 @@ def test_getting_session_id
assert_response :success assert_response :success
assert_equal session_id, response.body, "should be able to read session id without accessing the session hash" assert_equal session_id, response.body, "should be able to read session id without accessing the session hash"
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_deserializes_unloaded_class def test_deserializes_unloaded_class
Expand All @@ -133,6 +145,8 @@ def test_deserializes_unloaded_class
assert_response :success assert_response :success
end end
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_doesnt_write_session_cookie_if_session_id_is_already_exists def test_doesnt_write_session_cookie_if_session_id_is_already_exists
Expand All @@ -145,6 +159,8 @@ def test_doesnt_write_session_cookie_if_session_id_is_already_exists
assert_response :success assert_response :success
assert_equal nil, headers['Set-Cookie'], "should not resend the cookie again if session_id cookie is already exists" assert_equal nil, headers['Set-Cookie'], "should not resend the cookie again if session_id cookie is already exists"
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end


def test_prevents_session_fixation def test_prevents_session_fixation
Expand All @@ -160,6 +176,8 @@ def test_prevents_session_fixation
assert_response :success assert_response :success
assert_not_equal session_id, cookies['_session_id'] assert_not_equal session_id, cookies['_session_id']
end end
rescue Dalli::RingError => ex
skip ex.message, ex.backtrace
end end
rescue LoadError, RuntimeError, Dalli::DalliError rescue LoadError, RuntimeError, Dalli::DalliError
$stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again." $stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again."
Expand Down

0 comments on commit de8c41c

Please sign in to comment.