Skip to content

feat(cli): support header and header-command in config-ssh #10413

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 10 commits into from
Feb 7, 2024
Prev Previous commit
Next Next commit
chore: fix tests
  • Loading branch information
JoshVee committed Oct 19, 2023
commit c5e0ec15a34e860160f6bf28a75a207448eeea23
21 changes: 12 additions & 9 deletions cli/configssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,43 +588,46 @@ func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {
{
name: "Header command",
args: []string{
"--header-command", "/foo/bar/coder",
"--yes",
"--header-command", "printf h1=v1",
},
wantErr: false,
echoResponse: &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: echo.ProvisionApplyWithAgent(""),
},
wantErr: false,
wantConfig: wantConfig{
regexMatch: "--header-command \"/foo/bar/coder\" ssh",
regexMatch: "--header-command \"printf h1=v1\" ssh",
},
},
{
name: "Header command with double quotes",
args: []string{
"--header-command", "/foo/bar/coder arg1 arg2=\"quoted value\"",
"--yes",
"--header-command", "printf h1=v1 h2=\"v2\"",
},
wantErr: false,
echoResponse: &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: echo.ProvisionApplyWithAgent(""),
},
wantErr: false,
wantConfig: wantConfig{
regexMatch: "--header-command \"/foo/bar/coder arg1 arg2=\\\"quoted value\\\"\" ssh",
regexMatch: "--header-command \"printf h1=v1 h2=\\\\\"v2\\\\\"\" ssh",
},
},
{
name: "Header command with single quotes",
args: []string{
"--header-command", "/foo/bar/coder arg1 arg2='quoted value'",
"--yes",
"--header-command", "printf h1=v1 h2='v2'",
},
wantErr: false,
echoResponse: &echo.Responses{
Parse: echo.ParseComplete,
ProvisionApply: echo.ProvisionApplyWithAgent(""),
},
wantErr: false,
wantConfig: wantConfig{
regexMatch: "--header-command \"/foo/bar/coder arg1 arg2='quoted value'\" ssh",
regexMatch: "--header-command \"printf h1=v1 h2='v2'\" ssh",
},
},
}
Expand Down