(t *testing.T)
| 416 | } |
| 417 | |
| 418 | func TestLoginAcquiresRefreshLock(t *testing.T) { |
| 419 | // Login must run under the same lock the refresh path uses so it serializes against an in-flight refresh and wins |
| 420 | // either ordering. Pin that it acquires and releases the shared refresh lock; without the fix Login mutates the |
| 421 | // config without ever touching the lock and this fails. |
| 422 | authCfg := newTestAuthConfig(t) |
| 423 | |
| 424 | var locked, unlocked bool |
| 425 | authCfg.acquireRefreshLock = func(ctx context.Context, path string) (func(), error) { |
| 426 | locked = true |
| 427 | return func() { unlocked = true }, nil |
| 428 | } |
| 429 | |
| 430 | _, err := authCfg.Login("github.com", "test-user", "gho_token", "https", false) |
| 431 | require.NoError(t, err) |
| 432 | require.True(t, locked, "login must acquire the shared refresh lock") |
| 433 | require.True(t, unlocked, "login must release the shared refresh lock") |
| 434 | } |
| 435 | |
| 436 | func TestLoginProceedsWhenRefreshLockCannotBeAcquired(t *testing.T) { |
| 437 | // The cross-process lock is best effort: a filesystem without advisory locking (or a peer holding the lock past |
nothing calls this directly
no test coverage detected