You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem
The test case here:
https://github.com/aws/aws-toolkit-vscode/blob/359b1d8252a32e064482678110c5931630bd49e0/packages/core/src/test/awsService/ec2/model.test.ts#L132C9-L146C11
This test is unaware of the side-effect that it will attempt to
explicitly delete the keys when generating. Originally, the delete was
conditional on the keys existing in the directory, so this test case was
not a problem since they never existed. However, on windows that check
was faulty, leading to the case where the windows file system reported
that the keys existed, which lead it to attempting to delete the root
directory.
## Solution
- Modify `tryRun` to accept an `onStdOut` optional parameter that lets
us accept the overwrite prompt from `ssh-keygen`.
- Do not explicitly delete the files in the generation function, make
this part of the generation step.
The benefits of this approach are that we moved the side-effects to a
place where they are expected, in the key generation process itself. It
also inherently avoids the potentially faulty check if the key files
exist, as we only use `onStdOut` if when the keys exist.
### Notes
- `packages/core/src/awsService/ec2/sshKeyPair.ts:49` includes `any`
which should be `ChildProcess`. For some reason the import fails in CI,
so I left it as `any`. Refer to `attempt to import child process` commit
for logs.
---
<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Co-authored-by: Justin M. Keyes <[email protected]>
0 commit comments