-
Notifications
You must be signed in to change notification settings - Fork 18
Aws r53 tests #343
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
Merged
Merged
Aws r53 tests #343
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9503706
WIP, Test for DNS entries with TTL < 600s
085789b
dunno
b627db5
Merge branch 'master' into aws-r53-tests
e104442
MVP, check that all CNAME TTLs are >= 600s
da82a1d
Merge branch 'master' into aws-r53-tests
205059f
Add ids, __init__.py, other suggestions
7e1571b
Fix cname route53 ttl test name and docstring
ajvb 7b55591
Merge branch 'master' into aws-r53-tests
ajvb 597959d
fixed assert msg typo
ajvb a0214e0
Added check in get_client to silent unneeded warning
ajvb 7ffe602
Merge branch 'master' into aws-r53-tests
ajvb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| from conftest import botocore_client | ||
|
|
||
|
|
||
| def zones(): | ||
| """ | ||
| https://botocore.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.list_hosted_zones | ||
| """ | ||
| return ( | ||
| botocore_client.get("route53", "list_hosted_zones", [], {}) | ||
| .extract_key("HostedZones") | ||
| .flatten() | ||
| .values() | ||
| ) | ||
|
|
||
|
|
||
| def cnames(): | ||
| records = [] | ||
|
|
||
| for zone in zones(): | ||
| zone_id = zone["Id"].split("/")[2] | ||
| zone_records = ( | ||
| botocore_client.get( | ||
| "route53", "list_resource_record_sets", [], {"HostedZoneId": zone_id} | ||
| ) | ||
| .extract_key("ResourceRecordSets") | ||
| .flatten() | ||
| .values() | ||
| ) | ||
| records.extend([record for record in zone_records if record["Type"] == "CNAME"]) | ||
|
|
||
| return records | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import pytest | ||
|
|
||
| from aws.route53.resources import zones, cnames | ||
| from helpers import get_param_id | ||
|
|
||
|
|
||
| MINIMUM_TTL = 600 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "cnames", cnames(), ids=lambda record: get_param_id(record, "Name") | ||
| ) | ||
| def test_route53_cnames_minimum_ttl_or_greater(cnames): | ||
| """ | ||
| Tests that CNAMEs in Route53 have a TTL of 600 seconds or more. | ||
| """ | ||
| assert ( | ||
| int(cnames["TTL"]) >= MINIMUM_TTL | ||
| ), f"TTL is below the minimum of {MINIMUM_TTL}, it is currently set to {cnames['TTL']}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.