Permalink
Browse files

Fixing tests

  • Loading branch information...
1 parent e224636 commit 0e2a4df10b8c7bdfe59f9a52ab0331ccc3a9e570 @celeduc celeduc committed Jan 9, 2012
Showing with 67 additions and 85 deletions.
  1. +51 −65 failing_tests.txt
  2. +16 −20 test/test_simple_record.rb
View
@@ -1,4 +1,4 @@
-Finished tests in 538.747288s, 0.1114 tests/s, 4.0817 assertions/s.
+Finished tests in 342.810461s, 0.1750 tests/s, 6.4525 assertions/s.
1) Failure:
test_json(TestJson) [/home/ubuntu/src/simple_record/test/test_json.rb:51]:
@@ -12,9 +12,22 @@ puts is 1, should be 3.
test_single_clob(TestLobs) [/home/ubuntu/src/simple_record/test/test_lobs.rb:87]:
puts is 1, should be 0.
- 4) Failure:
-test_paginate(TestPagination) [/home/ubuntu/src/simple_record/test/test_pagination.rb:22]:
-models.size=0
+ 4) Error:
+test_paginate(TestPagination):
+Aws::AwsError: NoSuchDomain: The specified domain does not exist.
+REQUEST=sdb.amazonaws.com:443/
+REQUEST ID=0b716f33-d0cb-5452-c3d9-aa0c33f9197b
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/awsbase/awsbase.rb:572:in `request_info_impl'
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/awsbase/awsbase.rb:316:in `request_info2'
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/sdb/sdb_interface.rb:106:in `request_info'
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/sdb/sdb_interface.rb:407:in `batch_put_attributes'
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/sdb/sdb_interface.rb:412:in `rescue in batch_put_attributes'
+ /home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/aws-2.5.6/lib/sdb/sdb_interface.rb:406:in `batch_put_attributes'
+ /home/ubuntu/src/simple_record/lib/simple_record.rb:785:in `block in batch_save'
+ /home/ubuntu/src/simple_record/lib/simple_record.rb:776:in `each_slice'
+ /home/ubuntu/src/simple_record/lib/simple_record.rb:776:in `batch_save'
+ /home/ubuntu/src/simple_record/test/test_base.rb:61:in `create_my_models'
+ /home/ubuntu/src/simple_record/test/test_pagination.rb:17:in `test_paginate'
5) Failure:
test_big_result(TestResultsArray) [/home/ubuntu/src/simple_record/test/test_results_array.rb:27]:
@@ -24,100 +37,73 @@ Failed assertion, no message given.
test_limit(TestResultsArray) [/home/ubuntu/src/simple_record/test/test_results_array.rb:51]:
Failed assertion, no message given.
- 7) Error:
-test_atts_using_strings_and_symbols(TestSimpleRecord):
-RuntimeError: Invalid parameters passed to find: nil.
- /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:291:in `find_with_metadata'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:548:in `test_atts_using_strings_and_symbols'
+ 7) Failure:
+test_id_sharding(TestShards) [/home/ubuntu/src/simple_record/test/test_shards.rb:86]:
+Failed assertion, no message given.
8) Error:
test_base_attributes(TestSimpleRecord):
SimpleRecord::RecordNotSaved: Validation failed: Name must be unique.
/home/ubuntu/src/simple_record/lib/simple_record.rb:538:in `save!'
/home/ubuntu/src/simple_record/lib/simple_record.rb:543:in `save_with_validation!'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:459:in `test_base_attributes'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:455:in `test_base_attributes'
9) Error:
-test_batch_save(TestSimpleRecord):
-RuntimeError: Pre save failed on object [#<MyModel:0x9274d00 @errors=#<ActiveModel::Errors:0x9274c9c @base=#<MyModel:0x9274d00 ...>, @messages={:name=>["must be unique."]}>, @dirty={"name"=>nil, "age"=>nil, "cool"=>nil}, @attributes={"name"=>"Travis", "age"=>"09223372036854775840", "cool"=>"true"}, @attributes_rb={"name"=>"Travis", "save_count"=>nil}, @lobs={}, @new_record=true, @validation_context=nil>]
- /home/ubuntu/src/simple_record/lib/simple_record.rb:779:in `block (2 levels) in batch_save'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:777:in `each'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:777:in `block in batch_save'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:776:in `each_slice'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:776:in `batch_save'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:140:in `test_batch_save'
-
- 10) Failure:
-test_callbacks(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:189]:
-Failed assertion, no message given.
+test_callbacks(TestSimpleRecord):
+SimpleRecord::RecordNotFound: Couldn't find MyModel with ID ["3066e278-3ae6-11e1-a6e3-080027c736d0"]
+ /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:389:in `select_from_ids'
+ /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:300:in `find_with_metadata'
+ /home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:190:in `test_callbacks'
- 11) Error:
+ 10) Error:
test_constructor_using_belongs_to_ids(TestSimpleRecord):
NoMethodError: undefined method `name' for nil:NilClass
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:562:in `test_constructor_using_belongs_to_ids'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:558:in `test_constructor_using_belongs_to_ids'
- 12) Failure:
-test_count(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:328]:
+ 11) Failure:
+test_count(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:324]:
should have been 3 select, but was actually 2
- 13) Failure:
-test_create(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:119]:
+ 12) Failure:
+test_dates(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:477]:
Failed assertion, no message given.
- 14) Error:
-test_custom_id(TestSimpleRecord):
-SimpleRecord::RecordNotFound: Couldn't find MyModel with ID ["id-travis"]
- /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:389:in `select_from_ids'
- /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:300:in `find_with_metadata'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:67:in `test_custom_id'
-
- 15) Failure:
-test_dates(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:481]:
+ 13) Failure:
+test_dirty(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:225]:
Failed assertion, no message given.
- 16) Error:
-test_dirty(TestSimpleRecord):
-RuntimeError: Invalid parameters passed to find: nil.
- /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:291:in `find_with_metadata'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:211:in `test_dirty'
-
- 17) Error:
+ 14) Error:
test_explicit_class_name(TestSimpleRecord):
NoMethodError: undefined method `id' for nil:NilClass
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:603:in `test_explicit_class_name'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:599:in `test_explicit_class_name'
- 18) Error:
+ 15) Error:
test_funky_values(TestSimpleRecord):
-SimpleRecord::RecordNotFound: Couldn't find MyModel with ID ["0ba78b7e-3adf-11e1-8a2b-080027c736d0"]
+SimpleRecord::RecordNotFound: Couldn't find MyModel with ID ["382c257c-3ae6-11e1-a6e3-080027c736d0"]
/home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:389:in `select_from_ids'
/home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:300:in `find_with_metadata'
/home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:110:in `test_funky_values'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:107:in `test_funky_values'
- 19) Failure:
-test_nil_attr_deletion(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:412]:
+ 16) Failure:
+test_nil_attr_deletion(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:408]:
Failed assertion, no message given.
- 20) Failure:
+ 17) Failure:
test_save_get(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:26]:
Failed assertion, no message given.
- 21) Error:
+ 18) Error:
test_storage_format(TestSimpleRecord):
NoMethodError: undefined method `[]' for nil:NilClass
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:616:in `test_storage_format'
+ /home/ubuntu/src/simple_record/test/test_simple_record.rb:612:in `test_storage_format'
- 22) Error:
-test_updates(TestSimpleRecord):
-RuntimeError: Invalid parameters passed to find: nil.
- /home/ubuntu/src/simple_record/lib/simple_record/active_sdb.rb:291:in `find_with_metadata'
- /home/ubuntu/src/simple_record/lib/simple_record.rb:964:in `find'
- /home/ubuntu/src/simple_record/test/test_simple_record.rb:82:in `test_updates'
+ 19) Failure:
+test_updates(TestSimpleRecord) [/home/ubuntu/src/simple_record/test/test_simple_record.rb:94]:
+Name was not Travis2, it was Angela
- 23) Error:
+ 20) Error:
test_more_validations(TestValidations):
IOError: closed stream
/home/ubuntu/src/simple_record/lib/simple_record/logging.rb:23:in `write'
@@ -127,7 +113,7 @@ IOError: closed stream
/home/ubuntu/src/simple_record/lib/simple_record.rb:815:in `delete_all'
/home/ubuntu/src/simple_record/test/test_validations.rb:62:in `test_more_validations'
- 24) Error:
+ 21) Error:
test_validations(TestValidations):
IOError: closed stream
/home/ubuntu/src/simple_record/lib/simple_record/logging.rb:23:in `write'
@@ -140,4 +126,4 @@ IOError: closed stream
/home/ubuntu/src/simple_record/lib/simple_record/validations.rb:45:in `valid?'
/home/ubuntu/src/simple_record/test/test_validations.rb:31:in `test_validations'
-60 tests, 2199 assertions, 12 failures, 12 errors, 0 skips
+60 tests, 2212 assertions, 12 failures, 9 errors, 0 skips
View
@@ -59,7 +59,7 @@ def test_custom_id
custom_id = "id-travis"
mm = MyModel.new
mm.id = custom_id
- mm.name = "Travis"
+ mm.name = "Marvin"
mm.age = 32
mm.cool = true
mm.save
@@ -71,29 +71,26 @@ def test_custom_id
def test_updates
mm = MyModel.new
- mm.name = "Travis"
+ mm.name = "Angela"
mm.age = 32
mm.cool = true
mm.s1 = "Initial value"
mm.save
id = mm.id
- sleep 1
- mm = MyModel.find(id)
- mm.name = "Travis2"
+ mm = MyModel.find(id, :persistent_read=>true)
+ mm.name = "Angela2"
mm.age = 10
mm.cool = false
mm.s1 = "" # test blank string
puts 'mm=' + mm.inspect
mm.save
- sleep 1
-
puts 'mm2=' + mm.inspect
assert mm.s1 == "", "mm.s1 is not empty string, it is " + mm.s1.inspect
- mm = MyModel.find(id)
+ mm = MyModel.find(id, :persistent_read=>true)
assert mm.name == "Travis2", "Name was not Travis2, it was #{mm.name}"
assert mm.age == 10
assert mm.cool == false
@@ -114,7 +111,7 @@ def test_funky_values
def test_create
- mm = MyModel.create(:name=>"Travis", :age=>32, :cool=>true)
+ mm = MyModel.create(:name=>"Craven", :age=>32, :cool=>true)
puts 'mm=' + mm.inspect
assert !mm.id.nil?
end
@@ -128,12 +125,12 @@ def test_bad_query
def test_batch_save
items = []
mm = MyModel.new
- mm.name = "Travis"
+ mm.name = "Beavis"
mm.age = 32
mm.cool = true
items << mm
mm = MyModel.new
- mm.name = "Tritt"
+ mm.name = "Butthead"
mm.age = 44
mm.cool = false
items << mm
@@ -185,13 +182,12 @@ def test_callbacks
assert mm.errors.count == 1 # name is required
# test queued callback before_create
- mm.name = "Travis"
+ mm.name = "Oresund"
assert mm.save
- sleep 1
# now nickname should be set on before_create
assert mm.nickname == mm.name
- mm2 = MyModel.find(mm.id)
+ mm2 = MyModel.find(mm.id,:persistent_read=>true)
assert_equal mm2.nickname, mm.nickname
assert_equal mm2.name, mm.name
@@ -200,7 +196,7 @@ def test_callbacks
def test_dirty
mm = MyModel.new
- mm.name = "Travis"
+ mm.name = "Persephone"
mm.age = 32
mm.cool = true
mm.save
@@ -215,7 +211,7 @@ def test_dirty
assert mm2.age == mm.age
assert mm2.cool == mm.cool
- mm2.name = "Travis 2"
+ mm2.name = "Persephone 2"
mm2.save(:dirty=>true)
# todo: how do we assert this? perhaps change a value directly in sdb and see that it doesn't get overwritten.
@@ -284,7 +280,7 @@ def test_dirty
# http://api.rubyonrails.org/classes/ActiveRecord/Dirty.html#M002136
def test_changed
mm = MySimpleModel.new
- mm.name = "Travis"
+ mm.name = "Horace"
mm.age = 32
mm.cool = true
mm.save
@@ -303,12 +299,12 @@ def test_changed
assert mm.changes.size == 1
puts 'CHANGES=' + mm.changes.inspect
- assert mm.changes["name"][0] == "Travis"
+ assert mm.changes["name"][0] == "Horace"
assert mm.changes["name"][1] == "Jim"
assert mm.name_changed?
- assert mm.name_was == "Travis", "was #{mm.name_was}"
- assert mm.name_change[0] == "Travis"
+ assert mm.name_was == "Horace", "was #{mm.name_was}"
+ assert mm.name_change[0] == "Horace"
assert mm.name_change[1] == "Jim"
end

0 comments on commit 0e2a4df

Please sign in to comment.