Skip to content

Commit 487ae4e

Browse files
committed
Reducing flakiness of test/integration/concurrency_controls_test.rb
1 parent 86d323b commit 487ae4e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/integration/concurrency_controls_test.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,25 @@ class ConcurrencyControlsTest < ActiveSupport::TestCase
3636
end
3737

3838
test "schedule several conflicting jobs over the same record sequentially" do
39-
UpdateResultJob.set(wait: 0.23.seconds).perform_later(@result, name: "000", pause: 0.1.seconds)
39+
# Writes to @result at 0.4s
40+
UpdateResultJob.set(wait: 0.2.seconds).perform_later(@result, name: "000", pause: 0.2.seconds)
4041

4142
("A".."F").each_with_index do |name, i|
42-
NonOverlappingUpdateResultJob.set(wait: (0.2 + i * 0.01).seconds).perform_later(@result, name: name, pause: 0.3.seconds)
43+
# "A" is enqueued at 0.2s and writes to @result at 0.6s, the write at 0.4s gets overwritten
44+
NonOverlappingUpdateResultJob.set(wait: (0.2 + i * 0.1).seconds).perform_later(@result, name: name, pause: 0.4.seconds)
4345
end
4446

4547
("G".."K").each_with_index do |name, i|
46-
NonOverlappingUpdateResultJob.set(wait: (0.3 + i * 0.01).seconds).perform_later(@result, name: name)
48+
NonOverlappingUpdateResultJob.set(wait: (1 + i * 0.1).seconds).perform_later(@result, name: name)
4749
end
4850

4951
wait_for_jobs_to_finish_for(5.seconds)
5052
assert_no_unfinished_jobs
5153

54+
skip_active_record_query_cache do
55+
pp "#{@result.reload.status} <-- status"
56+
end
57+
5258
assert_stored_sequence @result, ("A".."K").to_a
5359
end
5460

0 commit comments

Comments
 (0)