diff --git a/cli/internal/oauth/manager/manager_test.go b/cli/internal/oauth/manager/manager_test.go index f49f7c54daec..0aefb8136e4d 100644 --- a/cli/internal/oauth/manager/manager_test.go +++ b/cli/internal/oauth/manager/manager_test.go @@ -4,6 +4,7 @@ import ( "context" "os" "testing" + "time" "github.com/docker/cli/cli/internal/oauth/api" "github.com/docker/cli/cli/oauth" @@ -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",