-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
refactor: Mark functions async in aws/customResources
and aws/deploy
#8698
Conversation
49a406c
to
d3cd92e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ifitzsimmons 🙇 Overall it looks good, I've had a few minor comments, but nothing major 👍
@@ -53,7 +53,7 @@ module.exports = { | |||
this.provider.serverless.service.provider.stackName && | |||
typeof this.provider.serverless.service.provider.stackName === 'string' | |||
) { | |||
return `${this.provider.serverless.service.provider.stackName}`; | |||
return this.provider.serverless.service.provider.stackName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch 👍
expect(fileExistsSyncStub.calledOnce).to.equal(true); | ||
expect(readFileSyncStub.calledOnce).to.equal(true); | ||
}); | ||
await awsDeploy.extendedValidate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have to be await
-ed here? According to the changes to extendedValidate
, that function is no longer async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. I'll fix all of those await
's.
expect(fileExistsSyncStub.calledOnce).to.equal(true); | ||
expect(readFileSyncStub.calledOnce).to.equal(true); | ||
}); | ||
await awsDeploy.extendedValidate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
delete awsDeploy.serverless.service.package.artifact; | ||
}); | ||
|
||
await awsDeploy.extendedValidate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
].join(''); | ||
expect(awsDeploy.serverless.cli.log.firstCall.calledWithExactly(msg)).to.be.equal(true); | ||
}); | ||
await awsDeploy.extendedValidate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@pgrzesik, I'm having a little trouble merging master back in to my branch. It looks like once I merge it, there are some |
Hey @ifitzsimmons, sorry for the trouble. Yesterday we had some upgrades to internal dependencies which are most likely causing issues for you - reinstalling all deps locally after you merge master back or rebase your branch on top of it should do the trick. Also, we switched to |
Okay cool, I wasn't sure how you felt about a rebase during the review process but I'll do that today. |
d37f96c
to
ebdcb74
Compare
@pgrzesik I got dinged for a dip in code coverage for the following changes... can we override that github action? I ran coverage locally for these files and nothing has changed between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ifitzsimmons for the changes. I've inspected the coverage changes and it's possible that I gave you the wrong suggestion with dropping the async
from extendedValidate
. It is used in a few places and possibly it's expected from that function to return a Promise (it's used in AwsInvoke
where we see the dropped coverage). Would you be able to change it back and validate again if we're experiencing coverage drop? Sorry for the trouble 🙇
@@ -126,11 +126,11 @@ describe('createStack', () => { | |||
it('should throw error if invalid stack name', () => { | |||
sandbox.stub(awsDeploy, 'create').resolves(); | |||
sandbox.stub(awsDeploy.provider, 'request').resolves(); | |||
awsDeploy.serverless.service.service = 'service-name'.repeat(100); | |||
awsDeploy.serverless.service.provider.stackName = 'service-name'.repeat(100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to change this test setup here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I'm not sure how or why that snuck in there.... I did perform a rebase, but to answer your question - no, there's no reason that that should be there.
I think that maybe I caused that confusion. I removed all async/await logic associated with |
@pgrzesik Am I missing something here. When I click on the codecov report, I am seeing that extendedValidate() is the violator. But when I run codecoverage locally, my branch has more code coverage than when I run coverage locally on master. |
I went through it once again and I believe it's just |
I'm happy to remove it, but it does add coverage. I added another function object, but no additional calls to if (functionObject.image) return; If that object did not have an - expect(fileExistsSyncStub.calledTwice).to.equal(true);
+ expect(fileExistsSyncStub.calledThrice).to.equal(true); Let me know if you still want me to remove that line!! I'm happy to do so |
Hey @ifitzsimmons 👋 I understand that it might add coverage there, but the definition of that image is invalid (currently it expects a valid Docker Image URI) and there are no extra assertions added, so there's little value in added coverage if we don't really test the outcome of the tested path. I'll say let's remove the whole
that was added, I don't think it will require changes in the assertions |
9272f8b
to
8a6689b
Compare
@pgrzesik Are you waiting on me for anything for this PR? |
Hello @ifitzsimmons, really sorry about it - I didn't realise that you pushed new changes because I'm monitoring review requests and comments via notifications and didn't get anything :( The best bet to ensure I or someone else sees the changes pushed is to request for re-review after completing changes. Unfortunately, I see that there's one extra conflicting file that will need to be resolved before we can merge this one |
Refactored Promise-returning functions for: * `lib/plugin/aws/customResources` * `lib/plugin/aws/deploy`
8a6689b
to
9a7565e
Compare
@pgrzesik That codecov issue resurfaced, can we ignore it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job 🙌 Coverage looks good, your diff has 100% of coverage 💯
aws/customResources
and aws/deploy
Refactored Promise-returning functions for:
lib/plugin/aws/customResources
lib/plugin/aws/deploy
I had to refactor a few tests after tagging functions with
async
keyword. I didn't change the functionality of the test, just the syntax.Addresses: #8368