Skip to content

Commit b7cd545

Browse files
authored
test: fix TestConfigSSH_FileWriteAndOptionsFlow on Windows 11 24H2 (#17410)
Fixes tests on Windows 11 due to `printf` not being a recognized command name.
1 parent 8cc743a commit b7cd545

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cli/configssh_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {
435435
"# :hostname-suffix=coder-suffix",
436436
"# :header=X-Test-Header=foo",
437437
"# :header=X-Test-Header2=bar",
438-
"# :header-command=printf h1=v1 h2=\"v2\" h3='v3'",
438+
"# :header-command=echo h1=v1 h2=\"v2\" h3='v3'",
439439
"#",
440440
}, "\n"),
441441
strings.Join([]string{
@@ -451,7 +451,7 @@ func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {
451451
"--hostname-suffix", "coder-suffix",
452452
"--header", "X-Test-Header=foo",
453453
"--header", "X-Test-Header2=bar",
454-
"--header-command", "printf h1=v1 h2=\"v2\" h3='v3'",
454+
"--header-command", "echo h1=v1 h2=\"v2\" h3='v3'",
455455
},
456456
},
457457
{
@@ -566,36 +566,36 @@ func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {
566566
name: "Header command",
567567
args: []string{
568568
"--yes",
569-
"--header-command", "printf h1=v1",
569+
"--header-command", "echo h1=v1",
570570
},
571571
wantErr: false,
572572
hasAgent: true,
573573
wantConfig: wantConfig{
574-
regexMatch: `ProxyCommand .* --header-command "printf h1=v1" ssh .* --ssh-host-prefix coder. %h`,
574+
regexMatch: `ProxyCommand .* --header-command "echo h1=v1" ssh .* --ssh-host-prefix coder. %h`,
575575
},
576576
},
577577
{
578578
name: "Header command with double quotes",
579579
args: []string{
580580
"--yes",
581-
"--header-command", "printf h1=v1 h2=\"v2\"",
581+
"--header-command", "echo h1=v1 h2=\"v2\"",
582582
},
583583
wantErr: false,
584584
hasAgent: true,
585585
wantConfig: wantConfig{
586-
regexMatch: `ProxyCommand .* --header-command "printf h1=v1 h2=\\\"v2\\\"" ssh .* --ssh-host-prefix coder. %h`,
586+
regexMatch: `ProxyCommand .* --header-command "echo h1=v1 h2=\\\"v2\\\"" ssh .* --ssh-host-prefix coder. %h`,
587587
},
588588
},
589589
{
590590
name: "Header command with single quotes",
591591
args: []string{
592592
"--yes",
593-
"--header-command", "printf h1=v1 h2='v2'",
593+
"--header-command", "echo h1=v1 h2='v2'",
594594
},
595595
wantErr: false,
596596
hasAgent: true,
597597
wantConfig: wantConfig{
598-
regexMatch: `ProxyCommand .* --header-command "printf h1=v1 h2='v2'" ssh .* --ssh-host-prefix coder. %h`,
598+
regexMatch: `ProxyCommand .* --header-command "echo h1=v1 h2='v2'" ssh .* --ssh-host-prefix coder. %h`,
599599
},
600600
},
601601
{

0 commit comments

Comments
 (0)