-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: KeyError: u'AWS_IAM' and add typing #2604
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
Conversation
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.
Somehow we missed this case in our tests, which led to a runtime error.
Let's add some tests, which can reproduce the situation when the key was missing and make sure it's not gonna happen again. Even unit test with mocking dependencies would be better then nothing
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.
Any tests to ensure the issue doesn't get introduced again later?
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.
How come these are easier to read? A lot of copy/pasting, if we change anything, need to change in 4 files?
Add to Transform Test Format file
9f4b737
to
c3439bd
Compare
Transforms should nearly always be deterministic, so no changes to transform outputs. Edit: neither is the epitome of readability to be fair. There's a few issues with unit tests for transforms, since it only tests small sections of the code. e.g. it could be possible to have a plugin that runs after the transform that breaks the transform, but the unit test would still pass. |
I believe it's possible, but shouldn't it be tested in that plugin then? I'm just worried that we keep adding tests which are flakey... |
These are not integration tests, they're never flaky. They run the full transform code locally and compare the outputs. |
gotcha, my bad :) |
Transform tests are not flaky. It's simply comparing the output against the expected json files. I do agree with Chris that unit tests are highly couple to implementation details, so if a small implementation detail changes we need to spend effort fixing them. |
Issue #, if available
Description of changes
Fixing Availability Dip
KeyError: u'AWS_IAM'
.Description of how you validated changes
Unit and integration tests passed locally.
Checklist
Examples?
Please reach out in the comments, if you want to add an example. Examples will be
added to
sam init
through https://github.com/awslabs/aws-sam-cli-app-templates/By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.