Skip to content

Commit

Permalink
Improved timeout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 9, 2024
1 parent 53113d3 commit d78650f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/timeouts_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_lock_timeout_retries
assert_retries CheckLockTimeoutRetries

# MySQL and MariaDB do not support DDL transactions
assert_equal (postgresql? ? 2 : 1), $migrate_attempts
assert_equal (postgresql? ? 3 : 1), $migrate_attempts
end

def test_lock_timeout_retries_no_retries
Expand All @@ -137,8 +137,8 @@ def test_lock_timeout_retries_transaction_ddl_transaction
assert_retries CheckLockTimeoutRetriesTransactionDdlTransaction

# retries entire migration, not transaction block alone
assert_equal 2, $migrate_attempts
assert_equal 2, $transaction_attempts
assert_equal 3, $migrate_attempts
assert_equal 3, $transaction_attempts
end

def test_lock_timeout_retries_no_ddl_transaction
Expand Down Expand Up @@ -197,7 +197,7 @@ def reset_timeouts

def with_lock_timeout_retries(lock: true)
StrongMigrations.lock_timeout = postgresql? ? 0.1 : 1
StrongMigrations.lock_timeout_retries = 1
StrongMigrations.lock_timeout_retries = 2
StrongMigrations.lock_timeout_retry_delay = 0
$migrate_attempts = 0
$transaction_attempts = 0
Expand All @@ -214,7 +214,7 @@ def with_lock_timeout_retries(lock: true)
StrongMigrations.lock_timeout_retry_delay = 5
end

def assert_retries(migration, retries: 1, **options)
def assert_retries(migration, retries: 2, **options)
retry_count = 0
count = proc do |message, *|
retry_count += 1 if message.include?("Lock timeout")
Expand Down

0 comments on commit d78650f

Please sign in to comment.