Skip to content

Commit

Permalink
Add integ test
Browse files Browse the repository at this point in the history
  • Loading branch information
aahung committed Mar 16, 2021
1 parent 3992f8e commit 3ac6120
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/integration/buildcmd/test_build_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,13 @@ def test_nested_build(self, use_container, cached, parallel):
)


@parameterized_class(
("template", "use_base_dir"),
[
(os.path.join("deep-nested", "template.yaml"), False),
(os.path.join("base-dir", "template", "template.yaml"), "use_base_dir"),
],
)
class TestBuildWithNestedStacks3Level(NestedBuildIntegBase):
"""
In this template, it has the same structure as .aws-sam/build
Expand All @@ -1610,7 +1617,12 @@ def test_nested_build(self):
if SKIP_DOCKER_TESTS:
self.skipTest(SKIP_DOCKER_MESSAGE)

cmdlist = self.get_command_list(use_container=True, cached=True, parallel=True)
cmdlist = self.get_command_list(
use_container=True,
cached=True,
parallel=True,
base_dir=(os.path.join(self.test_data_path, "base-dir") if self.use_base_dir else None),
)

LOG.info("Running Command: %s", cmdlist)
LOG.info(self.working_dir)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import json


def handler(event, context):
"""
FunctionA in leaf template
"""
return {"statusCode": 200, "body": json.dumps({"hello": "a2"})}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def layer_ping():
return "This is a Layer Ping from simple_python"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A hello world application.

Resources:
FunctionA:
Type: AWS::Serverless::Function
Properties:
Handler: main_a_2.handler
Runtime: python3.7
CodeUri: ChildStackX/ChildStackY/FunctionA
Timeout: 600

MyLayerVersion:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: MyLayer
Description: Layer description
ContentUri: ChildStackX/ChildStackY/MyLayerVersion
CompatibleRuntimes:
- python3.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import json


def handler(event, context):
"""
FunctionB in child template
"""
return {"statusCode": 200, "body": json.dumps({"hello": "b"})}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A hello world application.

Resources:
FunctionB:
Type: AWS::Serverless::Function
Properties:
Handler: main_b.handler
Runtime: python3.7
CodeUri: ChildStackX/FunctionB
Timeout: 600

ChildStackY:
Type: AWS::Serverless::Application
Properties:
Location: ChildStackY/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import json


def handler(event, context):
"""
FunctionA in root template
"""
return {"statusCode": 200, "body": json.dumps({"hello": "a"})}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A hello world application.

Resources:
FunctionA:
Type: AWS::Serverless::Function
Properties:
Handler: main_a.handler
Runtime: python3.7
CodeUri: FunctionA
Timeout: 600

ChildStackX:
Type: AWS::Serverless::Application
Properties:
Location: ChildStackX/template.yaml

0 comments on commit 3ac6120

Please sign in to comment.