spec/integration/lhm_spec.rb in lhm-1.1.0 vs spec/integration/lhm_spec.rb in lhm-1.2.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2011, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias +# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm' @@ -159,14 +159,16 @@ it "should perserve inserts during migration" do 50.times { |n| execute("insert into users set reference = '#{ n }'") } insert = Thread.new do 10.times do |n| + connect_master! execute("insert into users set reference = '#{ 100 + n }'") sleep(0.17) end end + sleep 2 options = { :stride => 10, :throttle => 97, :atomic_switch => false } Lhm.change_table(:users, options) do |t| t.add_column(:parallel, "INT(10) DEFAULT '0'") end @@ -185,9 +187,10 @@ 10.times do |n| execute("delete from users where id = '#{ n + 1 }'") sleep(0.17) end end + sleep 2 options = { :stride => 10, :throttle => 97, :atomic_switch => false } Lhm.change_table(:users, options) do |t| t.add_column(:parallel, "INT(10) DEFAULT '0'") end