(t *testing.T)
| 577 | } |
| 578 | |
| 579 | func TestLoginAcquiresRefreshLock(t *testing.T) { |
| 580 | // Login must run under the same lock the refresh path uses so it serializes against an in-flight refresh and wins |
| 581 | // either ordering. Pin that it acquires and releases the shared refresh lock; without the fix Login mutates the |
| 582 | // config without ever touching the lock and this fails. |
| 583 | authCfg := newTestAuthConfig(t) |
| 584 | |
| 585 | var locked, unlocked bool |
| 586 | authCfg.acquireRefreshLock = func(ctx context.Context, path string) (func(), error) { |
| 587 | locked = true |
| 588 | return func() { unlocked = true }, nil |
| 589 | } |
| 590 | |
| 591 | _, err := authCfg.Login("github.com", "test-user", "gho_token", "https", false) |
| 592 | require.NoError(t, err) |
| 593 | require.True(t, locked, "login must acquire the shared refresh lock") |
| 594 | require.True(t, unlocked, "login must release the shared refresh lock") |
| 595 | } |
| 596 | |
| 597 | func TestLoginProceedsWhenRefreshLockCannotBeAcquired(t *testing.T) { |
| 598 | // 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