Skip to content
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

Ensure its possible to remove stack with missing bucket #10306

Merged
merged 3 commits into from Dec 7, 2021

Conversation

pgrzesik
Copy link
Contributor

@pgrzesik pgrzesik commented Dec 3, 2021

Addresses the remove part of #3964

I've also cleaned up the tests in the process because there were a few leftover tests in bucket.test.js

Addressing deploy scenario will come in a separate PR

@pgrzesik pgrzesik self-assigned this Dec 3, 2021
@pgrzesik pgrzesik changed the title refactor: Use async/await syntax in bucket.js Ensure its possible to remove stack with missing bucket Dec 3, 2021
@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #10306 (27dd35a) into master (4c341b1) will increase coverage by 0.00%.
The diff coverage is 95.65%.

❗ Current head 27dd35a differs from pull request most recent head cf4a729. Consider uploading reports for the commit cf4a729 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10306   +/-   ##
=======================================
  Coverage   85.41%   85.42%           
=======================================
  Files         339      340    +1     
  Lines       13906    13917   +11     
=======================================
+ Hits        11878    11888   +10     
- Misses       2028     2029    +1     
Impacted Files Coverage Δ
lib/plugins/aws/lib/check-if-bucket-exists.js 85.71% <85.71%> (ø)
lib/plugins/aws/remove/index.js 100.00% <100.00%> (ø)
lib/plugins/aws/remove/lib/bucket.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c341b1...cf4a729. Read the comment docs.

@pgrzesik pgrzesik force-pushed the allow-for-removal-of-stack-with-removed-bucket branch from dace405 to 3bacaf5 Compare December 3, 2021 16:25
@pgrzesik pgrzesik requested a review from medikoo December 3, 2021 16:41
});
const bucketName = await this.provider.getServerlessDeploymentBucketName();
this.bucketName = bucketName;
this.checkIfBucketExists(bucketName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of that call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While implementing the second PR I've discovered a bug in this implementation for a specific case and I've adjusted the implementation a little bit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but we do not take result of that method. What is the reason of checking if it exists, if we're not interested in result?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has been changed, please see the updated version

.then(this.listObjects)
.then(this.deleteObjects);
await this.setServerlessDeploymentBucketName();
if (this.bucketName && (await this.checkIfBucketExists(this.bucketName))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't bucketName be unconditionally set here? (we didn't have that check before)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a scenario in which it won't be set so we need to leave this check this way

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a scenario that was already in master and was not handled? Or is this scenario introduced with this PR?

Also when exactly is that the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in master it was just throwing an error on SDK call in setServerlessDeploymentBucket, now we want to handle such situation gracefully

@pgrzesik pgrzesik force-pushed the allow-for-removal-of-stack-with-removed-bucket branch from 3bacaf5 to cf4a729 Compare December 6, 2021 16:57
@pgrzesik pgrzesik requested a review from medikoo December 6, 2021 17:06
Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

@pgrzesik pgrzesik merged commit 1a85a4a into master Dec 7, 2021
@pgrzesik pgrzesik deleted the allow-for-removal-of-stack-with-removed-bucket branch December 7, 2021 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants