Skip to content

fix(cli): display pasted session token #9710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
skip expecting token match on windows because it is a silly place
  • Loading branch information
johnstcn committed Sep 20, 2023
commit 0d054d639ba923d359c033b72fc7c36b56156d74
11 changes: 9 additions & 2 deletions cli/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli_test
import (
"context"
"fmt"
"runtime"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -170,7 +171,10 @@ func TestLogin(t *testing.T) {

pty.ExpectMatch("Paste your token here:")
pty.WriteLine(client.SessionToken())
pty.ExpectMatch(client.SessionToken())
if runtime.GOOS != "windows" {
// For some reason, the match does not show up on Windows.
pty.ExpectMatch(client.SessionToken())
}
Comment on lines +174 to +177
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually validated that this works on Windows, just appears to be a weird feature of ptytest. Disabling the session token echo check on Windows for now.

pty.ExpectMatch("Welcome to Coder")
<-doneChan
})
Expand All @@ -194,7 +198,10 @@ func TestLogin(t *testing.T) {

pty.ExpectMatch("Paste your token here:")
pty.WriteLine("an-invalid-token")
pty.ExpectMatch("an-invalid-token")
if runtime.GOOS != "windows" {
// For some reason, the match does not show up on Windows.
pty.ExpectMatch("an-invalid-token")
}
pty.ExpectMatch("That's not a valid token!")
cancelFunc()
<-doneChan
Expand Down