-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into tmp/1731113614/main
- Loading branch information
Showing
44 changed files
with
2,344 additions
and
558 deletions.
There are no files selected for viewing
This file contains 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 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 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,53 @@ | ||
from unittest import SkipTest | ||
from unittest.case import skipIf | ||
|
||
from parameterized import parameterized | ||
from tenacity import retry, retry_if_exception, stop_after_attempt | ||
|
||
from integration.config.service_names import EVENT_RULE_WITH_EVENT_BUS | ||
from integration.conftest import clean_bucket | ||
from integration.helpers.base_test import BaseTest | ||
from integration.helpers.resource import current_region_does_not_support | ||
|
||
retry_once = retry( | ||
stop=stop_after_attempt(2), | ||
# unittest raises SkipTest for skipping tests | ||
retry=retry_if_exception(lambda e: not isinstance(e, SkipTest)), | ||
) | ||
|
||
|
||
@skipIf( | ||
current_region_does_not_support([EVENT_RULE_WITH_EVENT_BUS]), | ||
"EVENT_RULE_WITH_EVENT_BUS is not supported in this testing region", | ||
) | ||
class TestConnectorsWithEventRuleToEB(BaseTest): | ||
def tearDown(self): | ||
# Some tests will create items in S3 Bucket, which result in stack DELETE_FAILED state | ||
# manually empty the bucket to allow stacks to be deleted successfully. | ||
bucket_name = self.get_physical_id_by_type("AWS::S3::Bucket") | ||
if bucket_name: | ||
clean_bucket(bucket_name, self.client_provider.s3_client) | ||
super().tearDown() | ||
|
||
@parameterized.expand( | ||
[ | ||
("combination/connector_event_rule_to_eb_default_write",), | ||
("combination/connector_event_rule_to_eb_custom_write",), | ||
] | ||
) | ||
@retry_once | ||
def test_connector_event_rule_eb_by_invoking_a_function(self, template_file_path): | ||
self.skip_using_service_detector(template_file_path) | ||
self.create_and_verify_stack(template_file_path) | ||
|
||
lambda_function_name = self.get_physical_id_by_logical_id("TriggerFunction") | ||
lambda_client = self.client_provider.lambda_client | ||
|
||
request_params = { | ||
"FunctionName": lambda_function_name, | ||
"InvocationType": "RequestResponse", | ||
"Payload": "{}", | ||
} | ||
response = lambda_client.invoke(**request_params) | ||
self.assertEqual(response.get("StatusCode"), 200) | ||
self.assertEqual(response.get("FunctionError"), None) |
This file contains 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 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 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 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
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
.../resources/expected/combination/function_with_alias_all_properties_and_layer_version.json
This file contains 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": "MyLambdaFunction", | ||
"ResourceType": "AWS::Lambda::Function" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyLambdaFunctionRole", | ||
"ResourceType": "AWS::IAM::Role" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyLambdaFunctionAliasLive", | ||
"ResourceType": "AWS::Lambda::Alias" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyLambdaFunctionVersion", | ||
"ResourceType": "AWS::Lambda::Version" | ||
}, | ||
{ | ||
"LogicalResourceId": "MyLayer", | ||
"ResourceType": "AWS::Lambda::LayerVersion" | ||
} | ||
] |
58 changes: 58 additions & 0 deletions
58
integration/resources/expected/single/graphqlapi-configuration.json
This file contains 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,58 @@ | ||
[ | ||
{ | ||
"LogicalResourceId": "SuperCoolAPI", | ||
"ResourceType": "AWS::AppSync::GraphQLApi" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPICloudWatchRole", | ||
"ResourceType": "AWS::IAM::Role" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPISchema", | ||
"ResourceType": "AWS::AppSync::GraphQLSchema" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPIQuerygetBook", | ||
"ResourceType": "AWS::AppSync::Resolver" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPINoneDataSource", | ||
"ResourceType": "AWS::AppSync::DataSource" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPIprocessQuery", | ||
"ResourceType": "AWS::AppSync::FunctionConfiguration" | ||
}, | ||
{ | ||
"LogicalResourceId": "SuperCoolAPIMyApiKey", | ||
"ResourceType": "AWS::AppSync::ApiKey" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPI", | ||
"ResourceType": "AWS::AppSync::GraphQLApi" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPICloudWatchRole", | ||
"ResourceType": "AWS::IAM::Role" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPISchema", | ||
"ResourceType": "AWS::AppSync::GraphQLSchema" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIQuerygetBook", | ||
"ResourceType": "AWS::AppSync::Resolver" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPINoneDataSource", | ||
"ResourceType": "AWS::AppSync::DataSource" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIprocessQuery", | ||
"ResourceType": "AWS::AppSync::FunctionConfiguration" | ||
}, | ||
{ | ||
"LogicalResourceId": "IntrospectionDisableSuperCoolAPIMyApiKey", | ||
"ResourceType": "AWS::AppSync::ApiKey" | ||
} | ||
] |
21 changes: 21 additions & 0 deletions
21
...resources/templates/combination/function_with_alias_all_properties_and_layer_version.yaml
This file contains 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,21 @@ | ||
Resources: | ||
MyLambdaFunction: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
CodeUri: ${codeuri} | ||
Handler: index.handler | ||
Runtime: nodejs20.x | ||
AutoPublishAlias: Live | ||
AutoPublishAliasAllProperties: true | ||
Layers: | ||
- !Ref MyLayer | ||
|
||
MyLayer: | ||
Type: AWS::Serverless::LayerVersion | ||
Properties: | ||
ContentUri: ${contenturi} | ||
RetentionPolicy: Delete | ||
PublishLambdaVersion: true | ||
Description: test | ||
Metadata: | ||
SamTransformTest: true |
94 changes: 94 additions & 0 deletions
94
integration/resources/templates/single/graphqlapi-configuration.yaml
This file contains 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,94 @@ | ||
Transform: AWS::Serverless-2016-10-31 | ||
Resources: | ||
SuperCoolAPI: | ||
Type: AWS::Serverless::GraphQLApi | ||
Properties: | ||
SchemaInline: | | ||
type Book { | ||
bookName: String | ||
id: ID | ||
} | ||
type Query { getBook(bookName: String): Book } | ||
OwnerContact: blah-blah | ||
Auth: | ||
Type: API_KEY | ||
ApiKeys: | ||
MyApiKey: {} | ||
Functions: | ||
processQuery: | ||
Runtime: | ||
Name: APPSYNC_JS | ||
Version: 1.0.0 | ||
DataSource: NONE | ||
InlineCode: | | ||
import { util } from '@aws-appsync/utils'; | ||
export function request(ctx) { | ||
const id = util.autoId(); | ||
return { payload: { ...ctx.args, id } }; | ||
} | ||
export function response(ctx) { | ||
return ctx.result; | ||
} | ||
Resolvers: | ||
Query: | ||
getBook: | ||
Pipeline: | ||
- processQuery | ||
|
||
IntrospectionDisableSuperCoolAPI: | ||
Type: AWS::Serverless::GraphQLApi | ||
Properties: | ||
SchemaInline: | | ||
type Book { | ||
bookName: String | ||
id: ID | ||
} | ||
type Query { getBook(bookName: String): Book } | ||
OwnerContact: blah-blah | ||
IntrospectionConfig: DISABLED | ||
QueryDepthLimit: 10 | ||
ResolverCountLimit: 100 | ||
Auth: | ||
Type: API_KEY | ||
ApiKeys: | ||
MyApiKey: {} | ||
Functions: | ||
processQuery: | ||
Runtime: | ||
Name: APPSYNC_JS | ||
Version: 1.0.0 | ||
DataSource: NONE | ||
InlineCode: | | ||
import { util } from '@aws-appsync/utils'; | ||
export function request(ctx) { | ||
const id = util.autoId(); | ||
return { payload: { ...ctx.args, id } }; | ||
} | ||
export function response(ctx) { | ||
return ctx.result; | ||
} | ||
Resolvers: | ||
Query: | ||
getBook: | ||
Pipeline: | ||
- processQuery | ||
Outputs: | ||
SuperCoolAPI: | ||
Description: AppSync API | ||
Value: !GetAtt SuperCoolAPI.GraphQLUrl | ||
MyApiKey: | ||
Description: API Id | ||
Value: !GetAtt SuperCoolAPIMyApiKey.ApiKey | ||
IntrospectionDisableSuperCoolAPI: | ||
Description: AppSync API | ||
Value: !GetAtt IntrospectionDisableSuperCoolAPI.GraphQLUrl | ||
IntrospectionDisableSuperCoolAPIMyApiKey: | ||
Description: API Id | ||
Value: !GetAtt IntrospectionDisableSuperCoolAPIMyApiKey.ApiKey | ||
|
||
Metadata: | ||
SamTransformTest: true |
Oops, something went wrong.