minor: insert test should use w = 2

This commit is contained in:
Kyle Banker 2012-02-15 12:55:14 -05:00
parent b299986eb4
commit 02d39a75c7
2 changed files with 11 additions and 11 deletions

View File

@ -18,22 +18,22 @@ class ReplicaSetInsertTest < Test::Unit::TestCase
end
def test_insert
@coll.save({:a => 20}, :safe => true)
@coll.save({:a => 20}, :safe => {:w => 2})
@rs.kill_primary
rescue_connection_failure do
@coll.save({:a => 30}, :safe => true)
@coll.save({:a => 30}, :safe => {:w => 2})
end
@coll.save({:a => 40}, :safe => true)
@coll.save({:a => 50}, :safe => true)
@coll.save({:a => 60}, :safe => true)
@coll.save({:a => 70}, :safe => true)
@coll.save({:a => 40}, :safe => {:w => 2})
@coll.save({:a => 50}, :safe => {:w => 2})
@coll.save({:a => 60}, :safe => {:w => 2})
@coll.save({:a => 70}, :safe => {:w => 2})
# Restart the old master and wait for sync
@rs.restart_killed_nodes
sleep(1)
sleep(5)
results = []
rescue_connection_failure do
@ -43,7 +43,7 @@ class ReplicaSetInsertTest < Test::Unit::TestCase
end
end
@coll.save({:a => 80}, :safe => true)
@coll.save({:a => 80}, :safe => {:w => 2})
@coll.find.each {|r| results << r}
[20, 30, 40, 50, 60, 70, 80].each do |a|
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a} on second find"

View File

@ -21,7 +21,7 @@ class ReplicaSetPooledInsertTest < Test::Unit::TestCase
def test_insert
expected_results = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@coll.save({:a => -1}, :safe => true)
@coll.save({:a => -1}, :safe => {:w => 2})
@rs.kill_primary
@ -29,7 +29,7 @@ class ReplicaSetPooledInsertTest < Test::Unit::TestCase
10.times do |i|
threads[i] = Thread.new do
rescue_connection_failure do
@coll.save({:a => i}, :safe => true)
@coll.save({:a => i}, :safe => {:w => 2})
end
end
end
@ -48,7 +48,7 @@ class ReplicaSetPooledInsertTest < Test::Unit::TestCase
end
end
@coll.save({:a => 10}, :safe => true)
@coll.save({:a => 10}, :safe => {:w => 2})
@coll.find.each {|r| results << r}
(expected_results + [10]).each do |a|
assert results.any? {|r| r['a'] == a}, "Could not find record for a => #{a} on second find"