Skip to content

Commit 1f5df66

Browse files
committed
e2e: ignore SSH known hosts
fixes error message in e2e windows pods: ``` Could not create directory '/.ssh' (Permission denied). Failed to add the host to the list of known hosts (/.ssh/known_hosts). ```
1 parent 87cc8bc commit 1f5df66

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/e2e/validation_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,12 @@ func (tc *testContext) runPowerShellSSHJob(name, command, ip string) (string, er
375375
}
376376

377377
keyMountDir := "/private-key"
378+
sshOptions := "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
378379
sshCommand := []string{"bash", "-c",
379380
fmt.Sprintf(
380381
// first determine if the host has PowerShell or cmd as the default shell by running a simple PowerShell
381382
// command. If it succeeds, then the host's default shell is PowerShell
382-
"if ssh -o StrictHostKeyChecking=no -i %s %s@%s 'Get-Help';"+
383+
"if ssh "+sshOptions+" -i %s %s@%s 'Get-Help';"+
383384
"then CMD_PREFIX=\"\";CMD_SUFFIX=\"\";"+
384385
// to respect quoting within the given command, wrap the command as a script block
385386
"COMMAND='{"+powershellDefaultCommand+"}';"+
@@ -388,7 +389,7 @@ func (tc *testContext) runPowerShellSSHJob(name, command, ip string) (string, er
388389
"COMMAND='{"+command+"}';"+
389390
"fi;"+
390391
// execute the command as a script block via the PowerShell call operator `&`
391-
"ssh -o StrictHostKeyChecking=no -i %s %s@%s ${CMD_PREFIX}\" & $COMMAND \"${CMD_SUFFIX}",
392+
"ssh "+sshOptions+" -i %s %s@%s ${CMD_PREFIX}\" & $COMMAND \"${CMD_SUFFIX}",
392393
filepath.Join(keyMountDir, secrets.PrivateKeySecretKey), tc.vmUsername(), ip,
393394
filepath.Join(keyMountDir, secrets.PrivateKeySecretKey), tc.vmUsername(), ip)}
394395

0 commit comments

Comments
 (0)