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

fix: add conditions to events and add tests #755

Merged
merged 3 commits into from
Jan 12, 2019

Conversation

keetonian
Copy link
Contributor

@keetonian keetonian commented Jan 10, 2019

Issue #, if available:
#142
Description of changes:
Adds another test for Conditions, as well as makes sure they are added to all Event types (except for API). Will follow up with a fix for Conditions for API event types (issue #758).

There were a few bugs in the Conditions feature, including how Events were handled. This pull request fixes these bugs.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-io
Copy link

codecov-io commented Jan 10, 2019

Codecov Report

Merging #755 into release/v1.10.0 will increase coverage by 0.31%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                 @@
##           release/v1.10.0    #755      +/-   ##
==================================================
+ Coverage            94.18%   94.5%   +0.31%     
==================================================
  Files                   67      67              
  Lines                 2685    2691       +6     
  Branches               478     481       +3     
==================================================
+ Hits                  2529    2543      +14     
+ Misses                  80      77       -3     
+ Partials                76      71       -5
Impacted Files Coverage Δ
samtranslator/model/eventsources/push.py 88.15% <100%> (+2.53%) ⬆️
samtranslator/model/eventsources/cloudwatchlogs.py 100% <100%> (ø) ⬆️
samtranslator/model/eventsources/pull.py 92% <100%> (+0.33%) ⬆️
samtranslator/model/sam_resources.py 96.08% <0%> (+0.35%) ⬆️

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 a2f6c23...7c29057. Read the comment docs.

@@ -47,5 +47,7 @@ def get_subscription_filter(self, function, permission):
subscription_filter.LogGroupName = self.LogGroupName
subscription_filter.FilterPattern = self.FilterPattern
subscription_filter.DestinationArn = function.get_runtime_attr("arn")
if 'Condition' in function.resource_attributes:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way we can not have to check this in every event source (and all new event sources moving forward)? Is there something we can do that's more DRY? I understand for certain event sources, we may need to override and do something different, e.g., S3. If there's no obvious way to do this, then I'm ok leaving it this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so, I'll look into it when I get a chance.

samtranslator/model/eventsources/push.py Show resolved Hide resolved
@@ -64,6 +64,8 @@ def to_cloudformation(self, **kwargs):
lambda_eventsourcemapping.StartingPosition = self.StartingPosition
lambda_eventsourcemapping.BatchSize = self.BatchSize
lambda_eventsourcemapping.Enabled = self.Enabled
if 'Condition' in function.resource_attributes:
Copy link
Contributor

Choose a reason for hiding this comment

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

If would be awesome to have a way to do this as a function and not need to worry about it in every resource. As we add more Events, resources, etc, this can be very easily forgotten.

@keetonian keetonian merged commit 47b221e into aws:release/v1.10.0 Jan 12, 2019
@keetonian keetonian deleted the release/v1.10.0-fix branch January 12, 2019 08:13
keetonian added a commit to keetonian/serverless-application-model that referenced this pull request Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants