mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
fix(cli): replace $SESSION_TOKEN placeholder for external apps (#17048)
Fixes an oversight in https://github.com/coder/coder/pull/17032 The FE has logic to replace the string `$SESSION_TOKEN` with a newly-minted session token. This adds corresponding logic to the `coder open app` command.
This commit is contained in:
@ -381,4 +381,29 @@ func TestOpenApp(t *testing.T) {
|
||||
w.RequireError()
|
||||
w.RequireContains("region not found")
|
||||
})
|
||||
|
||||
t.Run("ExternalAppSessionToken", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
client, ws, _ := setupWorkspaceForAgent(t, func(agents []*proto.Agent) []*proto.Agent {
|
||||
agents[0].Apps = []*proto.App{
|
||||
{
|
||||
Slug: "app1",
|
||||
Url: "https://example.com/app1?token=$SESSION_TOKEN",
|
||||
External: true,
|
||||
},
|
||||
}
|
||||
return agents
|
||||
})
|
||||
inv, root := clitest.New(t, "open", "app", ws.Name, "app1", "--test.open-error")
|
||||
clitest.SetupConfig(t, client, root)
|
||||
pty := ptytest.New(t)
|
||||
inv.Stdin = pty.Input()
|
||||
inv.Stdout = pty.Output()
|
||||
|
||||
w := clitest.StartWithWaiter(t, inv)
|
||||
w.RequireError()
|
||||
w.RequireContains("test.open-error")
|
||||
w.RequireContains(client.SessionToken())
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user