Skip to content
Browse files

Work around for lolruby bug. (Read on for explanation.)

We were experiencing CI test failures, for example:

* 3-1-stable: http://travis-ci.org/#!/rails/rails/builds/79473/L407
* master: http://travis-ci.org/#!/rails/rails/builds/79507/L80

These failures only happened on 1.8.7-p352, and we were only able to
reproduce on the Travis CI VM worker. We even tried creating a new 32
bit Ubuntu VM and running the tests on that, and it all worked fine.

After some epic trial and error, we discovered that replacing the
following:

  fuu = Marshal.load(Marshal.dump(fuu))

with:

  marshalled = Marshal.dump(fuu)
  fuu = Marshal.load(marshalled)

seemed to prevent the failure.

We have NO IDEA why this is. If anyone has some great insight to
contribute then that is welcome. Otherwise, hopefully this will just
help us get the CI green again.

Many thanks to @joshk for help with sorting this out.
  • Loading branch information...
1 parent 5b6ac34 commit 2db0455be6c6509a0aa1c73c8ed1bf96557e4d25 @jonleighton jonleighton committed Aug 13, 2011
Showing with 14 additions and 5 deletions.
  1. +6 −2 activerecord/test/cases/associations/extension_test.rb
  2. +8 −3 activerecord/test/cases/base_test.rb
View
8 activerecord/test/cases/associations/extension_test.rb
@@ -39,15 +39,19 @@ def test_marshalling_extensions
david = developers(:david)
assert_equal projects(:action_controller), david.projects.find_most_recent
- david = Marshal.load(Marshal.dump(david))
+ marshalled = Marshal.dump(david)
+ david = Marshal.load(marshalled)
+
assert_equal projects(:action_controller), david.projects.find_most_recent
end
def test_marshalling_named_extensions
david = developers(:david)
assert_equal projects(:action_controller), david.projects_extended_by_name.find_most_recent
- david = Marshal.load(Marshal.dump(david))
+ marshalled = Marshal.dump(david)
+ david = Marshal.load(marshalled)
+
assert_equal projects(:action_controller), david.projects_extended_by_name.find_most_recent
end
View
11 activerecord/test/cases/base_test.rb
@@ -1807,20 +1807,25 @@ def test_current_scope_is_reset
def test_marshal_round_trip
expected = posts(:welcome)
- actual = Marshal.load(Marshal.dump(expected))
+ marshalled = Marshal.dump(expected)
+ actual = Marshal.load(marshalled)
assert_equal expected.attributes, actual.attributes
end
def test_marshal_new_record_round_trip
- post = Marshal.load(Marshal.dump(Post.new))
+ marshalled = Marshal.dump(Post.new)
+ post = Marshal.load(marshalled)
+
assert post.new_record?, "should be a new record"
end
def test_marshalling_with_associations
post = Post.new
post.comments.build
- post = Marshal.load(Marshal.dump(post))
+
+ marshalled = Marshal.dump(post)
+ post = Marshal.load(marshalled)
assert_equal 1, post.comments.length
end

0 comments on commit 2db0455

Please sign in to comment.
Something went wrong with that request. Please try again.