-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Make remote invoke command available #5381
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
40ebd72
Enabled remote invoke command and updated docs link
hnnasit 71c5772
Created base integ glass for remote invoke tests
hnnasit f84a7e4
Added end2end integ tests for remote invoke
hnnasit 07ff79a
make black
hnnasit e660e80
Merge branch 'develop' into enable-remote-invoke
hnnasit 75125fd
Moved tearDownClass to base class
hnnasit 0c7cab2
Remove the check to skip appveyor tests on master branch
hnnasit cf0f557
Merge branch 'develop' into enable-remote-invoke
hnnasit 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
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
Empty file.
Empty file.
104 changes: 104 additions & 0 deletions
104
tests/integration/remote/invoke/remote_invoke_integ_base.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,104 @@ | ||
| from unittest import TestCase, skipIf | ||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| from tests.testing_utils import ( | ||
| get_sam_command, | ||
| run_command, | ||
| ) | ||
| from tests.integration.deploy.deploy_integ_base import DeployIntegBase | ||
|
|
||
| from samcli.lib.utils.boto_utils import get_boto_resource_provider_with_config, get_boto_client_provider_with_config | ||
| from samcli.lib.utils.cloudformation import get_resource_summaries | ||
|
|
||
|
|
||
| class RemoteInvokeIntegBase(TestCase): | ||
| template: Optional[Path] = None | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| cls.cmd = get_sam_command() | ||
| cls.test_data_path = cls.get_integ_dir().joinpath("testdata") | ||
| if cls.template: | ||
| cls.template_path = str(cls.test_data_path.joinpath("remote_invoke", cls.template)) | ||
| cls.events_folder_path = cls.test_data_path.joinpath("remote_invoke", "events") | ||
|
|
||
| @classmethod | ||
| def tearDownClass(cls): | ||
| # Delete the deployed stack | ||
| cls.cfn_client.delete_stack(StackName=cls.stack_name) | ||
|
|
||
| @staticmethod | ||
| def get_integ_dir(): | ||
| return Path(__file__).resolve().parents[2] | ||
|
|
||
| @staticmethod | ||
| def remote_invoke_deploy_stack(stack_name, template_path): | ||
|
|
||
| deploy_cmd = DeployIntegBase.get_deploy_command_list( | ||
| stack_name=stack_name, | ||
| template_file=template_path, | ||
| resolve_s3=True, | ||
| capabilities_list=["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"], | ||
| ) | ||
|
|
||
| run_command(deploy_cmd) | ||
|
|
||
| @classmethod | ||
| def create_resources_and_boto_clients(cls): | ||
| cls.remote_invoke_deploy_stack(cls.stack_name, cls.template_path) | ||
| stack_resource_summaries = get_resource_summaries( | ||
| get_boto_resource_provider_with_config(), | ||
| get_boto_client_provider_with_config(), | ||
| cls.stack_name, | ||
| ) | ||
| cls.stack_resources = { | ||
| resource_full_path: stack_resource_summary.physical_resource_id | ||
| for resource_full_path, stack_resource_summary in stack_resource_summaries.items() | ||
| } | ||
| cls.cfn_client = get_boto_client_provider_with_config()("cloudformation") | ||
| cls.lambda_client = get_boto_client_provider_with_config()("lambda") | ||
|
|
||
| @staticmethod | ||
| def get_command_list( | ||
| stack_name=None, | ||
| resource_id=None, | ||
| event=None, | ||
| event_file=None, | ||
| parameter_list=None, | ||
| output=None, | ||
| region=None, | ||
| profile=None, | ||
| beta_features=None, | ||
| ): | ||
| command_list = [get_sam_command(), "remote", "invoke"] | ||
|
|
||
| if stack_name: | ||
| command_list = command_list + ["--stack-name", stack_name] | ||
|
|
||
| if event: | ||
| command_list = command_list + ["-e", event] | ||
|
|
||
| if event_file: | ||
| command_list = command_list + ["--event-file", event_file] | ||
|
|
||
| if profile: | ||
| command_list = command_list + ["--parameter", parameter] | ||
|
|
||
| if output: | ||
| command_list = command_list + ["--output", output] | ||
|
|
||
| if parameter_list: | ||
| for (parameter, value) in parameter_list: | ||
| command_list = command_list + ["--parameter", f"{parameter}={value}"] | ||
|
|
||
| if region: | ||
| command_list = command_list + ["--region", region] | ||
|
|
||
| if beta_features is not None: | ||
| command_list = command_list + ["--beta-features" if beta_features else "--no-beta-features"] | ||
|
|
||
| if resource_id: | ||
| command_list = command_list + [resource_id] | ||
|
|
||
| return command_list |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| "list endpoints", | ||
| "list resources", | ||
| "deploy", | ||
| "remote invoke", | ||
| "package", | ||
| "delete", | ||
| "sync", | ||
|
|
||
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.