Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestConcurrentLocking ¶
func TestConcurrentLocking( t *testing.T, db *sql.DB, newLocker func(*testing.T) lock.Locker, lockTimeout time.Duration, )
TestConcurrentLocking is a reusable test helper that verifies concurrent locker behavior. It creates the specified number of lockers using the factory function and verifies that only one locker can acquire the lock at a time.
IMPORTANT: The newLocker function MUST create lockers that compete for the SAME lock resource. For table-based lockers, this means using the same lock ID. For advisory locks, the same lock ID. If each locker targets a different resource, multiple lockers will succeed (which breaks the test).
The test verifies the core locking contract:
- Only one locker should successfully acquire the lock when running concurrently
- The other lockers should fail to acquire the lock (blocked/timeout)
- All lockers should complete without hanging
func TestProviderLocking ¶
TestProviderLocking is a reusable test helper that verifies locking behavior. It creates the a bunch of providers with the same locker configuration and verifies that only one provider can apply migrations at a time.
The test verifies the core locking contract:
- Only one provider should apply migrations when running concurrently
- The other providers should apply zero migrations (blocked by lock)
- All providers should complete without errors
- Final database state should be consistent
Types ¶
This section is empty.