@@ -284,8 +284,8 @@ func TestLogin_RefreshFailureFallsBackToFlow(t *testing.T) {
284284}
285285
286286// TestLogin_InMemoryDoesNotRefresh verifies that WithInMemory runs the
287- // interactive flow instead of refreshing, so a rotated refresh token is
288- // never lost by not being written back .
287+ // interactive flow without refreshing: a rotated refresh token would not be
288+ // written back, and the file would keep a revoked one .
289289func TestLogin_InMemoryDoesNotRefresh (t * testing.T ) {
290290 resetDiscoveryCache ()
291291 provider := newRefreshProvider (t , refreshed )
@@ -324,8 +324,8 @@ func TestLogin_RefreshKeepsClientCredentialsMarker(t *testing.T) {
324324 assert .True (t , readStoredBundle (t , dir ).ClientCredentials )
325325}
326326
327- // TestLogin_RefreshPersistFailure verifies that Login reports a failure to
328- // write the refreshed token instead of returning a token the file lacks .
327+ // TestLogin_RefreshPersistFailure verifies that Login returns
328+ // ErrTokenPersist and no token when the refreshed token cannot be written .
329329func TestLogin_RefreshPersistFailure (t * testing.T ) {
330330 if runtime .GOOS == "windows" || os .Geteuid () == 0 {
331331 t .Skip ("needs a read-only directory" )
@@ -337,8 +337,9 @@ func TestLogin_RefreshPersistFailure(t *testing.T) {
337337 require .NoError (t , os .Chmod (dir , 0o500 ))
338338 t .Cleanup (func () { _ = os .Chmod (dir , 0o700 ) })
339339
340- _ , _ , err := loginNoPrompt (t , provider .URL , dir )
340+ tok , _ , err := loginNoPrompt (t , provider .URL , dir )
341341 require .ErrorIs (t , err , ErrTokenPersist )
342+ assert .Nil (t , tok )
342343}
343344
344345// TestRefreshToken_ErrorOmitsRefreshToken verifies that a failed refresh
@@ -473,8 +474,7 @@ func TestLogin_RefreshKeepsStoredIssuerForm(t *testing.T) {
473474}
474475
475476// TestLogin_RefreshDiscoveryFailure verifies that Login reports a discovery
476- // failure without prompting, instead of trying discovery again for the
477- // interactive flow.
477+ // failure after a single discovery request and without prompting.
478478func TestLogin_RefreshDiscoveryFailure (t * testing.T ) {
479479 resetDiscoveryCache ()
480480 var discoveries sync.Mutex
@@ -498,7 +498,7 @@ func TestLogin_RefreshDiscoveryFailure(t *testing.T) {
498498}
499499
500500// TestLogin_RefreshContextDeadline verifies that a refresh cut short by the
501- // caller's deadline returns ErrTimeout instead of starting the flow.
501+ // caller's deadline returns ErrTimeout and does not start the flow.
502502func TestLogin_RefreshContextDeadline (t * testing.T ) {
503503 resetDiscoveryCache ()
504504 provider := newRefreshProvider (t , func (form url.Values ) (int , string ) {
@@ -520,9 +520,9 @@ func TestLogin_RefreshContextDeadline(t *testing.T) {
520520}
521521
522522// TestLogin_ConcurrentRefreshSpendsRefreshTokenOnce verifies that
523- // concurrent Login calls in one process refresh once: the second waits ,
524- // re-reads the file and uses the token the first one wrote, instead of
525- // replaying a refresh token that a rotating provider has already revoked .
523+ // concurrent Login calls in one process refresh once: the others wait ,
524+ // re-read the file and use the token the first one wrote. The mock
525+ // provider rejects a reused refresh token, as a rotating provider does .
526526func TestLogin_ConcurrentRefreshSpendsRefreshTokenOnce (t * testing.T ) {
527527 resetDiscoveryCache ()
528528 var used sync.Map
0 commit comments