Skip to content

Commit

Permalink
Merge branch 'develop' into update_sam_transform_version
Browse files Browse the repository at this point in the history
  • Loading branch information
mndeveci authored Nov 23, 2023
2 parents 3ea899c + d378bc9 commit 277d0e6
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
; timeout any test after 30 minutes if it's hanging
timeout = 1800
log_cli = 1
log_cli_level = INFO
addopts = --maxfail=1000 -rf
Expand Down
22 changes: 0 additions & 22 deletions tests/integration/init/schemas/schemas_test_data_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,6 @@ def setUpClass(cls):
setup_partner_schema_data("partner-registry", schemas_client)
setup_schema_data_for_pagination("test-pagination", schemas_client)
setup_non_partner_schema_data("other-schema", schemas_client)
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
# 1: Hello World Example
# N: do not use DEFAULT hello world template
# 11: Java runtime
# 2: dependency manager maven
# eb-app-maven: response to name
# Y: clone/update the source repo
# 1: hello world

user_input = """
1
1
N
5
1
2
eb-app-maven
"""
with tempfile.TemporaryDirectory() as temp:
runner = CliRunner()
runner.invoke(init_cmd, ["--output-dir", temp], input=user_input)

def tearDown(self) -> None:
env = os.environ
Expand Down
56 changes: 44 additions & 12 deletions tests/integration/init/schemas/test_init_with_schemas_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@skipIf(SKIP_SCHEMA_TESTS, "Skip schema test")
@pytest.mark.xdist_group(name="sam_init")
class TestBasicInitWithEventBridgeCommand(SchemaTestDataSetup):
@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_aws_registry(self):
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
Expand All @@ -25,6 +26,8 @@ def test_init_interactive_with_event_bridge_app_aws_registry(self):
# 2: Maven
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# test-project: response to name
# Y: Use default aws configuration
# 1: select schema from cli_paginator
Expand All @@ -39,6 +42,7 @@ def test_init_interactive_with_event_bridge_app_aws_registry(self):
2
N
N
N
eb-app-maven
Y
1
Expand All @@ -57,6 +61,7 @@ def test_init_interactive_with_event_bridge_app_aws_registry(self):
Path(expected_output_folder, "HelloWorldFunction", "src", "main", "java", "schema").is_dir()
)

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_partner_registry(self):
# setup schema data
# WHEN the user follows interactive init prompts
Expand All @@ -66,6 +71,8 @@ def test_init_interactive_with_event_bridge_app_partner_registry(self):
# 2: Maven
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# test-project: response to name
# Y: Use default aws configuration
# 3: partner registry
Expand All @@ -79,6 +86,7 @@ def test_init_interactive_with_event_bridge_app_partner_registry(self):
2
N
N
N
eb-app-maven
Y
3
Expand Down Expand Up @@ -108,6 +116,7 @@ def test_init_interactive_with_event_bridge_app_partner_registry(self):
).is_file()
)

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_pagination(self):
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
Expand All @@ -116,6 +125,8 @@ def test_init_interactive_with_event_bridge_app_pagination(self):
# 2: Maven
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-maven: response to name
# Y: Use default aws configuration
# 4: select pagination-registry as registries
Expand All @@ -131,6 +142,7 @@ def test_init_interactive_with_event_bridge_app_pagination(self):
2
N
N
N
eb-app-maven
Y
4
Expand All @@ -151,6 +163,7 @@ def test_init_interactive_with_event_bridge_app_pagination(self):
Path(expected_output_folder, "HelloWorldFunction", "src", "main", "java", "schema").is_dir()
)

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_customer_registry(self):
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
Expand All @@ -159,6 +172,8 @@ def test_init_interactive_with_event_bridge_app_customer_registry(self):
# 2: Maven
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-maven: response to name
# Y: Use default aws configuration
# 2: select 2p-schema other-schema
Expand All @@ -172,6 +187,7 @@ def test_init_interactive_with_event_bridge_app_customer_registry(self):
2
N
N
N
eb-app-maven
Y
2
Expand Down Expand Up @@ -201,26 +217,30 @@ def test_init_interactive_with_event_bridge_app_customer_registry(self):
).is_file()
)

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_aws_schemas_python(self):
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
# 8: Infrastructure event management - Use case
# 7: Python 3.9
# 8: Python 3.9
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# eb-app-python38: response to name
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-python39: response to name
# Y: Use default aws configuration
# 4: select aws.events as registries
# 1: select aws schema

user_input = """
1
8
7
8
2
N
N
eb-app-python38
N
eb-app-python39
Y
1
4
Expand All @@ -231,18 +251,21 @@ def test_init_interactive_with_event_bridge_app_aws_schemas_python(self):
result = runner.invoke(init_cmd, ["--output-dir", temp], input=user_input)

self.assertFalse(result.exception)
expected_output_folder = Path(temp, "eb-app-python38")
expected_output_folder = Path(temp, "eb-app-python39")
self.assertTrue(expected_output_folder.exists)
self.assertTrue(expected_output_folder.is_dir())
self.assertTrue(Path(expected_output_folder, "hello_world_function", "schema").is_dir())

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_aws_schemas_go(self):
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
# 8: Infrastructure event management - Use case
# 1: Go 1.x
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-go: response to name
# Y: Use default aws configuration
# 4: select aws.events as registries
Expand All @@ -255,6 +278,7 @@ def test_init_interactive_with_event_bridge_app_aws_schemas_go(self):
2
N
N
N
eb-app-go
Y
4
Expand All @@ -270,14 +294,17 @@ def test_init_interactive_with_event_bridge_app_aws_schemas_go(self):
self.assertTrue(expected_output_folder.is_dir())
self.assertTrue(Path(expected_output_folder, "HelloWorld", "schema").is_dir())

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_non_default_profile_selection(self):
self._init_custom_config("mynewprofile", "us-west-2")
# WHEN the user follows interactive init prompts
# 1: AWS Quick Start Templates
# 8: Infrastructure event management - Use case
# 7: Python 3.9
# 8: Python 3.9
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-python38: response to name
# N: Use default profile
# 2: uses second profile from displayed one (myprofile)
Expand All @@ -288,11 +315,12 @@ def test_init_interactive_with_event_bridge_app_non_default_profile_selection(se
user_input = """
1
8
7
8
2
N
N
eb-app-python38
N
eb-app-python39
3
N
2
Expand All @@ -305,11 +333,12 @@ def test_init_interactive_with_event_bridge_app_non_default_profile_selection(se
result = runner.invoke(init_cmd, ["--output-dir", temp], input=user_input)

self.assertFalse(result.exception)
expected_output_folder = Path(temp, "eb-app-python38")
expected_output_folder = Path(temp, "eb-app-python39")
self.assertTrue(expected_output_folder.exists)
self.assertTrue(expected_output_folder.is_dir())
self.assertTrue(Path(expected_output_folder, "hello_world_function", "schema").is_dir())

@pytest.mark.timeout(300)
def test_init_interactive_with_event_bridge_app_non_supported_schemas_region(self):
self._init_custom_config("default", "cn-north-1")
# WHEN the user follows interactive init prompts
Expand All @@ -318,19 +347,22 @@ def test_init_interactive_with_event_bridge_app_non_supported_schemas_region(sel
# 7: Python 3.9
# 2: select event-bridge app from scratch
# N: disable adding xray tracing
# eb-app-python38: response to name
# N: disable cloudwatch insights
# N: disable structured logging
# eb-app-python39: response to name
# Y: Use default profile
# 1: select aws.events as registries
# 1: select aws schema

user_input = """
1
8
7
8
2
N
N
eb-app-python38
N
eb-app-python39
Y
1
1
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/init/test_init_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ def test_location_with_no_interactive_and_name(self):

@pytest.mark.xdist_group(name="sam_init")
class TestInteractiveInit(TestCase):
@pytest.mark.timeout(300)
def test_interactive_init(self):
# 1: AWS Quick Start Templates
# 1: Hello World Example
Expand Down Expand Up @@ -930,6 +931,7 @@ def test_interactive_init(self):
self.assertTrue(Path(expected_output_folder, "hello-world").is_dir())
self.assertTrue(Path(expected_output_folder, "hello-world", "app.mjs").is_file())

@pytest.mark.timeout(300)
def test_interactive_init_default_runtime(self):
user_input = """
1
Expand Down

0 comments on commit 277d0e6

Please sign in to comment.