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 failing aws_ses_identity integration tests #39560

Merged
merged 3 commits into from
May 17, 2018

Conversation

s-hertel
Copy link
Contributor

@s-hertel s-hertel commented May 1, 2018

Reduce boilerplate with yaml anchor

SUMMARY

Fixes #38713

At one point, an InvalidParameterValue error was raised in response to trying to turn off feedback forwarding if there are not bounce and complaint topics. Now this succeeds (using the AWS command line as well). An alternative would be to remove the additional safeguard code I added and remove the test that used to fail.

@orthanc Please review and I'll update the pull request if you want me to solve this differently.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/cloud/amazon/aws_ses_identity.py
test/integration/targets/aws_ses_identity/tasks/main.yaml

ANSIBLE VERSION
2.6.0

Reduce boilerplate with yaml anchor
@s-hertel s-hertel force-pushed the fix_aws_ses_identity_tests branch from 2a21e71 to 7033b15 Compare May 1, 2018 14:30
@ansibot ansibot added aws bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests. labels May 1, 2018
@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label May 1, 2018
@s-hertel
Copy link
Contributor Author

s-hertel commented May 1, 2018

cc @orthanc

@s-hertel s-hertel requested a review from ryansb May 1, 2018 14:46
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 9, 2018
Copy link
Contributor

@orthanc orthanc left a comment

Choose a reason for hiding this comment

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

Edit: This should have been assoicated with this line: https://github.com/ansible/ansible/pull/39560/files#diff-ad7f4dd9f70573d8f8d2f2ece53c0080R384

I think it would be better to check for BounceTopic and ComplaintTopic in the module params rather than identity_notification.

I've noticed a lot of eventual consistentency type issues with these APIs, so while theoretically it should be OK to check identity notification here since we re-loaded it I think it would be better to just make sure the desired state topics and feedback forwarding are consistent.

Essentially checking that both of the following are truthy:

module.params.get('bouce_notifications')['topic']
module.params.get('complaint_notifications')['topic']

Both the params might be None though so probably need a need a none check.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels May 10, 2018
@@ -409,6 +413,7 @@ def update_identity_notifications(connection, module):
for notification_type in ('Bounce', 'Complaint', 'Delivery'):
changed |= update_notification_topic(connection, module, identity, identity_notifications, notification_type)
changed |= update_notification_topic_headers(connection, module, identity, identity_notifications, notification_type)
identity_notifications = get_identity_notifications(connection, module, identity)
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be no need to do this in the loop. If we want to keep the current approach of basing the feedback forwarding check on the reloaded identitiy notifications then we should move this outside the loop so that we only make one additional API call rather than 3.

The three topic settings won't affect each other so there should be no need to update between iterations of the loop.

But as I indicated in the other review comment, I think we're probably better checking the feedback forwarding state against the desired state of these topics rather than the reloaded identity_notifications since that way we avoid eventual consistency issues

@orthanc
Copy link
Contributor

orthanc commented May 13, 2018

@s-hertel I've made the changes I would like in my fork, be good if this commit could just be added to this PR as it's based on your changes: orthanc@7468ea7

Basically this is swapping to validating the desired feedback forwarding state against the desired topics state so there's no need to re-load the notification state from the API.

I've also added a couple of additional integration tests for the "specified 1 topic" cases to make sure the logic remains correct.

@s-hertel
Copy link
Contributor Author

Thanks so much @orthanc! Sorry for taking a bit to get back to this.

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label May 15, 2018
@orthanc
Copy link
Contributor

orthanc commented May 16, 2018

shipit

@ansibot ansibot added shipit This PR is ready to be merged by Core and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 16, 2018
@s-hertel s-hertel merged commit 571c183 into ansible:devel May 17, 2018
@mattclay
Copy link
Member

@s-hertel Will this be backported to stable-2.5?

s-hertel added a commit to s-hertel/ansible that referenced this pull request May 17, 2018
* Fix failing aws_ses_identity integration tests

Reduce boilerplate with yaml anchor

* remove unstable test alias

* Update feedback forwarding check to use desired state rather than
repeated API calls.

(cherry picked from commit 571c183)
@s-hertel
Copy link
Contributor Author

@mattclay opened #40350 to backport

achinthagunasekara pushed a commit to achinthagunasekara/ansible that referenced this pull request May 23, 2018
* Fix failing aws_ses_identity integration tests

Reduce boilerplate with yaml anchor

* remove unstable test alias

* Update feedback forwarding check to use desired state rather than
repeated API calls.
nitzmahone pushed a commit that referenced this pull request May 30, 2018
* Fix failing aws_ses_identity integration tests (#39560)

* Fix failing aws_ses_identity integration tests

Reduce boilerplate with yaml anchor

* remove unstable test alias

* Update feedback forwarding check to use desired state rather than
repeated API calls.

(cherry picked from commit 571c183)

* changelog
jacum pushed a commit to jacum/ansible that referenced this pull request Jun 26, 2018
* Fix failing aws_ses_identity integration tests

Reduce boilerplate with yaml anchor

* remove unstable test alias

* Update feedback forwarding check to use desired state rather than
repeated API calls.
ilicmilan pushed a commit to ilicmilan/ansible that referenced this pull request Nov 7, 2018
* Fix failing aws_ses_identity integration tests

Reduce boilerplate with yaml anchor

* remove unstable test alias

* Update feedback forwarding check to use desired state rather than
repeated API calls.
@ansible ansible locked and limited conversation to collaborators May 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aws bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unstable integration test aws_ses_identity
5 participants