-
Notifications
You must be signed in to change notification settings - Fork 737
test(ec2): fix flaky windows test. #5661
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
+20
−14
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions. |
justinmk3
reviewed
Sep 25, 2024
justinmk3
approved these changes
Sep 26, 2024
Contributor
Author
|
/retryBuilds |
justinmk3
reviewed
Sep 27, 2024
justinmk3
approved these changes
Sep 27, 2024
Co-authored-by: Justin M. Keyes <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
tryRunto accept anonStdOutoptional parameter that lets us accept the overwrite prompt fromssh-keygen.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
onStdOutif when the keys exist.Notes
packages/core/src/awsService/ec2/sshKeyPair.ts:49includesanywhich should beChildProcess. For some reason the import fails in CI, so I left it asany. Refer toattempt to import child processcommit for logs.License: I confirm that my contribution is made under the terms of the Apache 2.0 license.