Skip to content

Commit a24de71

Browse files
committed
test(ec2): unreliable test "SSH Agent can start the agent on windows"
Problem: SSH Agent can start the agent on windows: Error: Test length exceeded max duration: 30 seconds [No Pending UI Elements Found] at Timeout._onTimeout (D:\a\aws-toolkit-vscode\aws-toolkit-vscode\packages\core\src\test\setupUtil.ts:46:32) Solution: - retry 2 times.
1 parent 0b2bccd commit a24de71

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/core/src/test/shared/extensions/ssh.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@ import { isWin } from '../../../shared/vscode/env'
1515

1616
describe('SSH Agent', function () {
1717
it('can start the agent on windows', async function () {
18+
this.retries(2)
19+
1820
// TODO: we should also skip this test if not running in CI
1921
// Local machines probably won't have admin permissions in the spawned processes
2022
if (process.platform !== 'win32') {
2123
this.skip()
2224
}
2325

24-
const runCommand = (command: string) => {
25-
const args = ['-Command', command]
26-
return new ChildProcess('powershell.exe', args).run({ rejectOnErrorCode: true })
26+
async function runCommand(command: string) {
27+
const args = ['-NoLogo', '-NonInteractive', '-ExecutionPolicy', 'RemoteSigned', '-Command', command]
28+
return await new ChildProcess('pwsh.exe', args).run({ rejectOnErrorCode: true })
2729
}
2830

29-
const getStatus = () => {
30-
return runCommand('echo (Get-Service ssh-agent).Status').then((o) => o.stdout)
31+
async function getStatus() {
32+
const c = await runCommand('echo (Get-Service ssh-agent).Status')
33+
return c.stdout
3134
}
3235

3336
await runCommand('Stop-Service ssh-agent')

0 commit comments

Comments
 (0)