-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix warning when using default stage name and FailOnWarnings is on #2726
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
GavinZZ
merged 8 commits into
aws:develop
from
GavinZZ:default_stage_name_with_failonwarnings
Dec 14, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
02b9038
Fix warning when using default stage name and FailOnWarnings is on
GavinZZ 680c7fe
Added integration test to make sure we can now deploy
GavinZZ ca14c4c
Format file
GavinZZ a343ad0
Update naming
GavinZZ 71d6706
Merge branch 'develop' into default_stage_name_with_failonwarnings
GavinZZ ef3bbe7
Added comment explaining backward compatibility
GavinZZ d818805
Merge branch 'default_stage_name_with_failonwarnings' of github.com:G…
GavinZZ ecc8ce8
Merge branch 'develop' into default_stage_name_with_failonwarnings
GavinZZ 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
33 changes: 33 additions & 0 deletions
33
integration/combination/test_http_api_with_fail_on_warnings.py
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,33 @@ | ||
from unittest.case import skipIf | ||
from parameterized import parameterized | ||
|
||
from integration.helpers.base_test import BaseTest | ||
from integration.helpers.resource import current_region_does_not_support | ||
from integration.config.service_names import HTTP_API | ||
|
||
|
||
@skipIf(current_region_does_not_support([HTTP_API]), "HttpApi is not supported in this testing region") | ||
class TestHttpApiWithFailOnWarnings(BaseTest): | ||
@parameterized.expand( | ||
[ | ||
("combination/http_api_with_fail_on_warnings_and_default_stage_name", True), | ||
("combination/http_api_with_fail_on_warnings_and_default_stage_name", False), | ||
] | ||
) | ||
def test_http_api_with_fail_on_warnings(self, file_name, disable_value): | ||
parameters = [ | ||
{ | ||
"ParameterKey": "FailOnWarningsValue", | ||
"ParameterValue": "true" if disable_value else "false", | ||
"UsePreviousValue": False, | ||
"ResolvedValue": "string", | ||
} | ||
] | ||
|
||
self.create_and_verify_stack(file_name, parameters) | ||
|
||
http_api_id = self.get_physical_id_by_type("AWS::ApiGatewayV2::Api") | ||
apigw_v2_client = self.client_provider.api_v2_client | ||
|
||
api_result = apigw_v2_client.get_api(ApiId=http_api_id) | ||
self.assertEqual(api_result["ResponseMetadata"]["HTTPStatusCode"], 200) |
22 changes: 22 additions & 0 deletions
22
...resources/expected/combination/http_api_with_fail_on_warnings_and_default_stage_name.json
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,22 @@ | ||
[ | ||
{ | ||
"LogicalResourceId": "AppFunctionAppHandlerPermission", | ||
"ResourceType": "AWS::Lambda::Permission" | ||
}, | ||
{ | ||
"LogicalResourceId": "AppApi", | ||
"ResourceType": "AWS::ApiGatewayV2::Api" | ||
}, | ||
{ | ||
"LogicalResourceId": "AppApiApiGatewayDefaultStage", | ||
"ResourceType": "AWS::ApiGatewayV2::Stage" | ||
}, | ||
{ | ||
"LogicalResourceId": "AppFunction", | ||
"ResourceType": "AWS::Lambda::Function" | ||
}, | ||
{ | ||
"LogicalResourceId": "AppFunctionRole", | ||
"ResourceType": "AWS::IAM::Role" | ||
} | ||
] |
29 changes: 29 additions & 0 deletions
29
...esources/templates/combination/http_api_with_fail_on_warnings_and_default_stage_name.yaml
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,29 @@ | ||
Parameters: | ||
FailOnWarningsValue: | ||
Type: String | ||
AllowedValues: [true, false] | ||
|
||
Resources: | ||
AppApi: | ||
Type: AWS::Serverless::HttpApi | ||
Properties: | ||
FailOnWarnings: !Ref FailOnWarningsValue | ||
StageName: $default | ||
AppFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
InlineCode: | | ||
def handler(event, context): | ||
print("Hello, world!") | ||
Runtime: python3.8 | ||
Architectures: | ||
- x86_64 | ||
Events: | ||
AppHandler: | ||
Type: HttpApi | ||
Properties: | ||
ApiId: !Ref AppApi | ||
|
||
Metadata: | ||
SamTransformTest: true |
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
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
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
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
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
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
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
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
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
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
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.