Skip to content

Commit

Permalink
tests: fix flaky TestLoginDevice test
Browse files Browse the repository at this point in the history
Signed-off-by: Laura Brehm <[email protected]>
  • Loading branch information
laurazard committed Aug 1, 2024
1 parent 9075518 commit 2ebbc01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/internal/oauth/manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os"
"testing"
"time"

"github.com/docker/cli/cli/internal/oauth/api"
"github.com/docker/cli/cli/oauth"
Expand Down Expand Up @@ -122,6 +123,8 @@ func TestLoginDevice(t *testing.T) {
}, nil
}
waitForDeviceToken := func(state api.State) (api.TokenResponse, error) {
// make sure that the context is cancelled before this returns
time.Sleep(500 * time.Millisecond)
return api.TokenResponse{
AccessToken: validToken,
RefreshToken: "refresh-token",
Expand Down

0 comments on commit 2ebbc01

Please sign in to comment.