(t *testing.T)
| 247 | } |
| 248 | |
| 249 | func TestMultiLocker_WaitLock_Success(t *testing.T) { |
| 250 | db, mock := redismock.NewClientMock() |
| 251 | |
| 252 | multiLocker := NewMultiLocker(db, []string{"key-b", "key-a"}, "test-value") |
| 253 | |
| 254 | // Expect locks to be acquired in sorted order |
| 255 | mock.ExpectSetNX("key-a", "test-value", 5*time.Second).SetVal(true) |
| 256 | mock.ExpectSetNX("key-b", "test-value", 5*time.Second).SetVal(true) |
| 257 | |
| 258 | err := multiLocker.WaitLock(context.Background(), 5*time.Second, 2*time.Second) |
| 259 | assert.NoError(t, err) |
| 260 | assert.NoError(t, mock.ExpectationsWereMet()) |
| 261 | } |
| 262 | |
| 263 | func TestMultiLocker_WaitLock_ContextCanceled(t *testing.T) { |
| 264 | db, mock := redismock.NewClientMock() |
nothing calls this directly
no test coverage detected