Skip to content

Commit ac912dd

Browse files
p-schlickmannrosa
authored andcommitted
Reducing flakiness of test/integration/concurrency_controls_test.rb
1 parent 4b6159c commit ac912dd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/integration/concurrency_controls_test.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ 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)

0 commit comments

Comments
 (0)