For a couple of days I get on the order of 50 errors when running the AR unit tests with MySQL and PostgreSQL. I have recreated the test databases without effect. Otherwise I have haven''t investigated this closely. Below is the top of the stack trace on all the errors ActiveRecord::SerializationTypeMismatch: content was supposed to be a Hash, but was a String ./test/../lib/active_record/base.rb:1313:in `unserialize_attribute'' ./test/../lib/active_record/base.rb:1283:in `read_attribute'' It''s only the tests that are failing, AR by itself still works nicely. I take it there''s something pretty obvious I''m overlooking... Michael -- Michael Schuerig Airtight arguments have mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org vacuous conclusions. http://www.schuerig.de/michael/ --A.O. Rorty, Explaining Emotions
On 9/25/05, Michael Schuerig <michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote:> > For a couple of days I get on the order of 50 errors when running the AR > unit tests with MySQL and PostgreSQL. I have recreated the test > databases without effect. Otherwise I have haven''t investigated this > closely. Below is the top of the stack trace on all the errors > > ActiveRecord::SerializationTypeMismatch: content was supposed to be a > Hash, but was a String > ./test/../lib/active_record/base.rb:1313:in `unserialize_attribute'' > ./test/../lib/active_record/base.rb:1283:in `read_attribute'' > > It''s only the tests that are failing, AR by itself still works nicely. I > take it there''s something pretty obvious I''m overlooking... > > MichaelI just did a clean checkout and I only get 4 ''duplicate key violates unique constraint'' errors in postgresql. sqlite is fine though. Since installing with darwin ports I haven''t been able to get mysql to work so I''m not sure there. -- rick http://techno-weenie.net
On Sep 25, 2005, at 6:10 PM, Michael Schuerig wrote:> > For a couple of days I get on the order of 50 errors when running the > AR > unit tests with MySQL and PostgreSQL. I have recreated the test > databases without effect. Otherwise I have haven''t investigated this > closely. Below is the top of the stack trace on all the errors > > ActiveRecord::SerializationTypeMismatch: content was supposed to be a > Hash, but was a String > ./test/../lib/active_record/base.rb:1313:in `unserialize_attribute'' > ./test/../lib/active_record/base.rb:1283:in `read_attribute'' > > It''s only the tests that are failing, AR by itself still works nicely. > I > take it there''s something pretty obvious I''m overlooking... > > Michael > > -- > Michael Schuerig Airtight arguments have > mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org vacuous conclusions. > http://www.schuerig.de/michael/ --A.O. Rorty, Explaining EmotionsThey''re all green for me ... http://ibook.lunchboxsoftware.com/ar-tests.html -- Scott Barron Lunchbox Software http://lunchboxsoftware.com http://lunchroom.lunchboxsoftware.com http://rubyi.st
On Sep 25, 2005, at 6:56 PM, Rick Olson wrote:> On 9/25/05, Michael Schuerig <michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote: >> >> For a couple of days I get on the order of 50 errors when running the >> AR >> unit tests with MySQL and PostgreSQL. I have recreated the test >> databases without effect. Otherwise I have haven''t investigated this >> closely. Below is the top of the stack trace on all the errors >> >> ActiveRecord::SerializationTypeMismatch: content was supposed to be a >> Hash, but was a String >> ./test/../lib/active_record/base.rb:1313:in >> `unserialize_attribute'' >> ./test/../lib/active_record/base.rb:1283:in `read_attribute'' >> >> It''s only the tests that are failing, AR by itself still works >> nicely. I >> take it there''s something pretty obvious I''m overlooking... >> >> Michael > > I just did a clean checkout and I only get 4 ''duplicate key violates > unique constraint'' errors in postgresql. sqlite is fine though. > Since installing with darwin ports I haven''t been able to get mysql to > work so I''m not sure there.The orders table, right? I hit this occasionally, I think something isn''t cleaning up after itself. It''s a problem with the tests, not AR. -- Scott Barron Lunchbox Software http://lunchboxsoftware.com http://lunchroom.lunchboxsoftware.com http://rubyi.st
On Sep 25, 2005, at 5:55 PM, Scott Barron wrote:> On Sep 25, 2005, at 6:56 PM, Rick Olson wrote: > >> On 9/25/05, Michael Schuerig <michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org> wrote: >> >>> >>> For a couple of days I get on the order of 50 errors when running >>> the AR >>> unit tests with MySQL and PostgreSQL. I have recreated the test >>> databases without effect. Otherwise I have haven''t investigated this >>> closely. Below is the top of the stack trace on all the errors >>> >>> ActiveRecord::SerializationTypeMismatch: content was supposed to >>> be a >>> Hash, but was a String >>> ./test/../lib/active_record/base.rb:1313:in >>> `unserialize_attribute'' >>> ./test/../lib/active_record/base.rb:1283:in `read_attribute'' >>> >>> It''s only the tests that are failing, AR by itself still works >>> nicely. I >>> take it there''s something pretty obvious I''m overlooking... >>> >>> Michael >>> >> >> I just did a clean checkout and I only get 4 ''duplicate key violates >> unique constraint'' errors in postgresql. sqlite is fine though. >> Since installing with darwin ports I haven''t been able to get >> mysql to >> work so I''m not sure there. >> > > The orders table, right? I hit this occasionally, I think > something isn''t > cleaning up after itself. It''s a problem with the tests, not AR.I hit this once in a while, too. If I manually delete from orders in activerecord_unittest before running the tests, it all works. Though I think Scott reported that this workaround didn''t work for him, at least once... - Jamis
On 9/25/05, Scott Barron <scott-HDQKq3lYuGDk1uMJSBkQmQ@public.gmane.org> wrote:> They''re all green for me ... > http://ibook.lunchboxsoftware.com/ar-tests.htmlFixtures.reset_sequences wasn''t being called on orders for those 4 failures, so I added it to a setup method. I rolled the fixed test with a sequence patch for postgresql: http://dev.rubyonrails.com/ticket/2292 -- rick http://techno-weenie.net
Michael Schuerig
2005-Sep-26 01:08 UTC
Inheritable_attributes and Ruby 1.8.3 (was: Error messages from AR unit tests?)
On Monday 26 September 2005 00:56, Rick Olson wrote:> I just did a clean checkout and I only get 4 ''duplicate key violates > unique constraint'' errors in postgresql. sqlite is fine though. > Since installing with darwin ports I haven''t been able to get mysql > to work so I''m not sure there.When I disable these two tests from base_test.rb the errors disappear. def test_serialized_attribute myobj = MyObject.new(''value1'', ''value2'') topic = Topic.create("content" => myobj) Topic.serialize("content", MyObject) assert_equal(myobj, topic.content) end def test_serialized_attribute_with_class_constraint myobj = MyObject.new(''value1'', ''value2'') topic = Topic.create("content" => myobj) Topic.serialize(:content, Hash) assert_raise(ActiveRecord::SerializationTypeMismatch) { Topic.find(topic.id).content } settings = { "color" => "blue" } Topic.find(topic.id).update_attribute("content", settings) assert_equal(settings, Topic.find(topic.id).content) Topic.serialize(:content) end I''m running Ruby 1.8.3 and I don''t have 1.8.2 at hand to test against it. My best conjecture is that inheritable_attributes somehow got messed up. Trying to get an idea what''s happening, I resorted to some print debugging def test_serialized_attribute p Topics.serialized_attributes ... Now, the output never shows up on the console, must be trapped somewhere in the test setup, but, lo and behold, the problem is gone, too. I''m too tired right now to track this down. Michael -- Michael Schuerig Most people would rather die than think. mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org In fact, they do. http://www.schuerig.de/michael/ --Bertrand Russell
Scott Barron
2005-Sep-26 02:37 UTC
Re: Inheritable_attributes and Ruby 1.8.3 (was: Error messages from AR unit tests?)
On Sep 25, 2005, at 9:08 PM, Michael Schuerig wrote:> > I''m running Ruby 1.8.3 and I don''t have 1.8.2 at hand to test against > it. My best conjecture is that inheritable_attributes somehow got > messed up. Trying to get an idea what''s happening, I resorted to some > print debuggingOK, with 1.8.3 I can confirm that I am getting the same results that you are, however 1.8.2 is fine. -- Scott Barron Lunchbox Software http://lunchboxsoftware.com http://lunchroom.lunchboxsoftware.com http://rubyi.st
Scott Barron
2005-Sep-26 03:10 UTC
Re: Inheritable_attributes and Ruby 1.8.3 (was: Error messages from AR unit tests?)
On Sep 25, 2005, at 10:37 PM, Scott Barron wrote:> > On Sep 25, 2005, at 9:08 PM, Michael Schuerig wrote: >> >> I''m running Ruby 1.8.3 and I don''t have 1.8.2 at hand to test against >> it. My best conjecture is that inheritable_attributes somehow got >> messed up. Trying to get an idea what''s happening, I resorted to some >> print debugging > > OK, with 1.8.3 I can confirm that I am getting the same results that > you are, > however 1.8.2 is fine.The problem is this: # Ruby 1.8.2 irb(main):003:0> [1, 2, 3].to_yaml => "--- \n- 1\n- 2\n- 3" # Ruby 1.8.3 irb(main):002:0> [1, 2, 3].to_yaml => "- 1\n- 2\n- 3\n" Notice the 1.8.3 is missing the "--- \n" header, and this is what the unserialize methods are searching for to determine that this is a YAML serialized object. So, I''m not sure if this should be considered a bug with YAML, or if we should work around it. A fix I have working is to check for and add the header in quoting.rb if it''s not present. This makes the tests pass for 1.8.3. -- Scott Barron Lunchbox Software http://lunchboxsoftware.com http://lunchroom.lunchboxsoftware.com http://rubyi.st