diff --git a/samcli/commands/_utils/experimental.py b/samcli/commands/_utils/experimental.py index 51dcfb44d0..3d0acbaa32 100644 --- a/samcli/commands/_utils/experimental.py +++ b/samcli/commands/_utils/experimental.py @@ -43,7 +43,6 @@ class ExperimentalFlag: """Class for storing all experimental related ConfigEntries""" All = ExperimentalEntry("experimentalAll", EXPERIMENTAL_ENV_VAR_PREFIX + "FEATURES") - Accelerate = ExperimentalEntry("experimentalAccelerate", EXPERIMENTAL_ENV_VAR_PREFIX + "ACCELERATE") Esbuild = ExperimentalEntry("experimentalEsbuild", EXPERIMENTAL_ENV_VAR_PREFIX + "ESBUILD") diff --git a/samcli/commands/_utils/options.py b/samcli/commands/_utils/options.py index 62a9021e5e..e2eeebb54f 100644 --- a/samcli/commands/_utils/options.py +++ b/samcli/commands/_utils/options.py @@ -367,12 +367,11 @@ def common_observability_click_options(): "-t", is_flag=True, help="Tail events. This will ignore the end time argument and continue to fetch events as they " - "become available. [Beta Feature] If in beta --tail without a --name will pull from all possible resources", + "become available. If option --tail without a --name will pull from all possible resources", ), click.option( "--output", help=""" - [Beta Feature] The formatting style of the command output. Following options are available:\n TEXT: Prints information as regular text with some formatting (default option)\n JSON: Prints each line as JSON without formatting diff --git a/samcli/commands/logs/command.py b/samcli/commands/logs/command.py index 71a228df2f..991fd0eb86 100644 --- a/samcli/commands/logs/command.py +++ b/samcli/commands/logs/command.py @@ -8,12 +8,6 @@ from samcli.cli.cli_config_file import configuration_option, TomlProvider from samcli.cli.main import pass_context, common_options as cli_framework_options, aws_creds_options, print_cmdline_args -from samcli.commands._utils.experimental import ( - ExperimentalFlag, - force_experimental_option, - experimental, - prompt_experimental, -) from samcli.commands._utils.options import common_observability_options from samcli.commands.logs.validation_and_exception_handlers import ( SAM_LOGS_ADDITIONAL_EXCEPTION_HANDLERS, @@ -42,9 +36,10 @@ $ sam logs -n HelloWorldFunction --stack-name mystack --tail \n \b Use the --filter option to quickly find logs that match terms, phrases or values in your log events. -$ sam logs -n HelloWorldFunction --stack-name mystack --filter "error" \n +$ sam logs -n HelloWorldFunction --stack-name mystack --filter 'error' \n \b -[Beta Features] +Fetch logs for all supported resources in your application, and additionally from the specified log groups. +$ sam logs --cw-log-group /aws/lambda/myfunction-123 --cw-log-group /aws/lambda/myfunction-456 \b You can now fetch logs from supported resources, by only providing --stack-name parameter $ sam logs --stack-name mystack \n @@ -60,9 +55,9 @@ "--name", "-n", multiple=True, - help="Name(s) of your AWS Lambda function. If this function is a part of a CloudFormation stack, " - "this can be the LogicalID of function resource in the CloudFormation/SAM template. " - "[Beta Feature] Multiple names can be provided by repeating the parameter again. " + help="The name of the resource for which to fetch logs. If this resource is a part of an AWS CloudFormation stack, " + "this can be the LogicalID of the resource in the CloudFormation/SAM template. " + "Multiple names can be provided by repeating the parameter again. " "If resource is in a nested stack, name can be prepended by nested stack name to pull logs " "from that resource (NestedStackLogicalId/ResourceLogicalId). " "If it is not provided and no --cw-log-group have been given, it will scan " @@ -81,27 +76,22 @@ "--include-traces", "-i", is_flag=True, - help="[Beta Feature] Include the XRay traces in the log output.", + help="Include the XRay traces in the log output.", ) @click.option( "--cw-log-group", multiple=True, - help="[Beta Feature] " - "Additional CloudWatch Log group names that are not auto-discovered based upon --name parameter. " + help="Additional CloudWatch Log group names that are not auto-discovered based upon --name parameter. " "When provided, it will only tail the given CloudWatch Log groups. If you want to tail log groups related " "to resources, please also provide their names as well", ) @common_observability_options -@experimental @cli_framework_options @aws_creds_options @pass_context @track_command @check_newer_version @print_cmdline_args -@force_experimental_option("include_traces", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 -@force_experimental_option("cw_log_group", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 -@force_experimental_option("output", config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 @command_exception_handler(SAM_LOGS_ADDITIONAL_EXCEPTION_HANDLERS) @stack_name_cw_log_group_validation def cli( @@ -162,10 +152,7 @@ def do_cli( from samcli.lib.observability.util import OutputOption from samcli.lib.utils.boto_utils import get_boto_client_provider_with_config, get_boto_resource_provider_with_config - if not names or len(names) > 1: - if not prompt_experimental(ExperimentalFlag.Accelerate): - return - else: + if names and len(names) <= 1: click.echo( "You can now use 'sam logs' without --name parameter, " "which will pull the logs from all supported resources in your stack." diff --git a/samcli/commands/sync/command.py b/samcli/commands/sync/command.py index 5aaa205af1..fd642e897d 100644 --- a/samcli/commands/sync/command.py +++ b/samcli/commands/sync/command.py @@ -46,13 +46,6 @@ ) from samcli.cli.context import Context from samcli.lib.sync.watch_manager import WatchManager -from samcli.commands._utils.experimental import ( - ExperimentalFlag, - experimental, - is_experimental_enabled, - set_experimental, - update_experimental_context, -) if TYPE_CHECKING: # pragma: no cover from samcli.commands.deploy.deploy_context import DeployContext @@ -62,7 +55,7 @@ LOG = logging.getLogger(__name__) HELP_TEXT = """ -[Beta Feature] Update/Sync local artifacts to AWS +Update/Sync local artifacts to AWS By default, the sync command runs a full stack update. You can specify --code or --watch to switch modes. \b @@ -79,20 +72,8 @@ Enter Y to proceed with the command, or enter N to cancel: """ -SYNC_CONFIRMATION_TEXT_WITH_BETA = """ -This feature is currently in beta. Visit the docs page to learn more about the AWS Beta terms https://aws.amazon.com/service-terms/. -The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without -performing a CloudFormation deployment. This will cause drift in your CloudFormation stack. -**The sync command should only be used against a development stack**. - -Confirm that you are synchronizing a development stack and want to turn on beta features. - -Enter Y to proceed with the command, or enter N to cancel: -""" - - -SHORT_HELP = "[Beta Feature] Sync a project to AWS" +SHORT_HELP = "Sync a project to AWS" DEFAULT_TEMPLATE_NAME = "template.yaml" DEFAULT_CAPABILITIES = ("CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND") @@ -149,7 +130,6 @@ @notification_arns_option @tags_option @capabilities_option(default=DEFAULT_CAPABILITIES) # pylint: disable=E1120 -@experimental @pass_context @track_command @image_repository_validation @@ -249,17 +229,9 @@ def do_cli( from samcli.commands.package.package_context import PackageContext from samcli.commands.deploy.deploy_context import DeployContext - confirmation_text = SYNC_CONFIRMATION_TEXT - - if not is_experimental_enabled(ExperimentalFlag.Accelerate): - confirmation_text = SYNC_CONFIRMATION_TEXT_WITH_BETA - - if not click.confirm(Colored().yellow(confirmation_text), default=True): + if not click.confirm(Colored().yellow(SYNC_CONFIRMATION_TEXT), default=True): return - set_experimental(ExperimentalFlag.Accelerate) - update_experimental_context() - s3_bucket_name = s3_bucket or manage_stack(profile=profile, region=region) build_dir = DEFAULT_BUILD_DIR_WITH_AUTO_DEPENDENCY_LAYER if dependency_layer else DEFAULT_BUILD_DIR diff --git a/samcli/commands/traces/command.py b/samcli/commands/traces/command.py index f5542582e6..bd787d939e 100644 --- a/samcli/commands/traces/command.py +++ b/samcli/commands/traces/command.py @@ -12,16 +12,22 @@ from samcli.lib.observability.util import OutputOption from samcli.lib.telemetry.metric import track_command from samcli.lib.utils.version_checker import check_newer_version -from samcli.commands._utils.experimental import ExperimentalFlag, force_experimental + LOG = logging.getLogger(__name__) HELP_TEXT = """ -[Beta Feature] Use this command to fetch AWS X-Ray traces generated by your stack.\n +Use this command to fetch AWS X-Ray traces generated by your stack.\n +\b +Run the following command to fetch X-Ray traces by ID. +$ sam traces --trace-id tracing-id-1 --trace-id tracing-id-2 +\b +Run the following command to tail X-Ray traces as they become available. +$ sam traces --tail """ -@click.command("traces", help=HELP_TEXT, short_help="[Beta Feature] Fetch AWS X-Ray traces") +@click.command("traces", help=HELP_TEXT, short_help="Fetch AWS X-Ray traces") @configuration_option(provider=TomlProvider(section="parameters")) @click.option( "--trace-id", @@ -31,7 +37,6 @@ ) @common_observability_options @cli_framework_options -@force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 @aws_creds_options @pass_context @track_command diff --git a/samcli/lib/build/build_strategy.py b/samcli/lib/build/build_strategy.py index 3f3892d7a3..a62d2e7012 100644 --- a/samcli/lib/build/build_strategy.py +++ b/samcli/lib/build/build_strategy.py @@ -10,7 +10,6 @@ from copy import deepcopy from typing import Callable, Dict, List, Any, Optional, cast, Set, Tuple, TypeVar -from samcli.commands._utils.experimental import is_experimental_enabled, ExperimentalFlag from samcli.lib.utils import osutils from samcli.lib.utils.async_utils import AsyncContext from samcli.lib.utils.hash import dir_checksum @@ -168,7 +167,7 @@ def build_single_function_definition(self, build_definition: FunctionBuildDefini single_build_dir, build_definition.metadata, container_env_vars, - build_definition.dependencies_dir if is_experimental_enabled(ExperimentalFlag.Accelerate) else None, + build_definition.dependencies_dir, build_definition.download_dependencies, ) function_build_results[single_full_path] = result @@ -215,7 +214,7 @@ def build_single_layer_definition(self, layer_definition: LayerBuildDefinition) layer.build_architecture, single_build_dir, layer_definition.env_vars, - layer_definition.dependencies_dir if is_experimental_enabled(ExperimentalFlag.Accelerate) else None, + layer_definition.dependencies_dir, layer_definition.download_dependencies, ) } @@ -573,7 +572,7 @@ def _is_incremental_build_supported(self, runtime: Optional[str]) -> bool: if self._use_container: return False - if not runtime or not is_experimental_enabled(ExperimentalFlag.Accelerate): + if not runtime: return False for supported_runtime_prefix in CachedOrIncrementalBuildStrategyWrapper.SUPPORTED_RUNTIME_PREFIXES: diff --git a/samcli/lib/observability/cw_logs/cw_log_group_provider.py b/samcli/lib/observability/cw_logs/cw_log_group_provider.py index d42d4d17fc..6cf4c2dbaa 100644 --- a/samcli/lib/observability/cw_logs/cw_log_group_provider.py +++ b/samcli/lib/observability/cw_logs/cw_log_group_provider.py @@ -4,7 +4,6 @@ import logging from typing import Optional -from samcli.commands._utils.experimental import force_experimental, ExperimentalFlag from samcli.lib.utils.resources import ( AWS_LAMBDA_FUNCTION, AWS_APIGATEWAY_RESTAPI, @@ -53,7 +52,6 @@ def for_lambda_function(function_name: str) -> str: return "/aws/lambda/{}".format(function_name) @staticmethod - @force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 def for_apigw_rest_api(rest_api_id: str, stage: str = "Prod") -> str: """ Returns the CloudWatch Log Group Name created by default for the AWS Api gateway rest api with given id @@ -76,7 +74,6 @@ def for_apigw_rest_api(rest_api_id: str, stage: str = "Prod") -> str: return "API-Gateway-Execution-Logs_{}/{}".format(rest_api_id, stage) @staticmethod - @force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 def for_apigwv2_http_api( boto_client_provider: BotoProviderType, http_api_id: str, stage: str = "$default" ) -> Optional[str]: @@ -110,7 +107,6 @@ def for_apigwv2_http_api( return log_group_name @staticmethod - @force_experimental(config_entry=ExperimentalFlag.Accelerate) # pylint: disable=E1120 def for_step_functions( boto_client_provider: BotoProviderType, step_function_name: str, diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py index f7eae8050c..7695412434 100644 --- a/tests/integration/buildcmd/test_build_cmd.py +++ b/tests/integration/buildcmd/test_build_cmd.py @@ -1653,9 +1653,9 @@ def test_no_cached_override_build(self): cmdlist = self.get_command_list(parameter_overrides=overrides) cmdlist.extend(["--config-file", config_file]) command_result = run_command(cmdlist, cwd=self.working_dir) - self.assertTrue( - "Valid cache found, copying previously built resources for following functions" - in str(command_result.stderr), + self.assertRegex( + str(command_result.stderr), + "Manifest is not changed for .* running incremental build", "Should have built using cache", ) cmdlist.extend(["--no-cached"]) @@ -1728,8 +1728,17 @@ def test_repeated_cached_build_hits_cache(self, use_container): container_env_var="FOO=BAR" if use_container else None, ) - cache_invalid_output = "Cache is invalid, running build and copying resources " - cache_valid_output = "Valid cache found, copying previously built resources " + cache_invalid_output_use_container = "Cache is invalid, running build and copying resources " + cache_valid_output_use_container = "Valid cache found, copying previously built resources " + + cache_invalid_output_no_container = "Manifest file is changed" + cache_valid_output_no_container = "Manifest is not changed" + + cache_invalid_output, cache_valid_output = ( + (cache_invalid_output_use_container, cache_valid_output_use_container) + if use_container + else (cache_invalid_output_no_container, cache_valid_output_no_container) + ) LOG.info("Running Command (cache should be invalid): %s", cmdlist) command_result = run_command(cmdlist, cwd=self.working_dir).stderr.decode("utf-8") diff --git a/tests/integration/logs/logs_integ_base.py b/tests/integration/logs/logs_integ_base.py index b9bb20ffee..a6b8d5cbe1 100644 --- a/tests/integration/logs/logs_integ_base.py +++ b/tests/integration/logs/logs_integ_base.py @@ -25,7 +25,6 @@ def get_logs_command_list( start_time: Optional[str] = None, end_time: Optional[str] = None, output: Optional[str] = None, - beta_features: bool = False, ): command_list = [get_sam_command(), "logs", "--stack-name", stack_name] @@ -46,7 +45,5 @@ def get_logs_command_list( command_list += ["--end-time", end_time] if output: command_list += ["--output", output] - if beta_features: - command_list += ["--beta-features"] return command_list diff --git a/tests/integration/logs/test_logs_command.py b/tests/integration/logs/test_logs_command.py index c3a3f24b62..b929b73b47 100644 --- a/tests/integration/logs/test_logs_command.py +++ b/tests/integration/logs/test_logs_command.py @@ -120,7 +120,7 @@ def _test_apigw_logs(self, apigw_name, path): apigw_url = f"{self._get_output_value(apigw_name_from_output)}{path}" apigw_result = requests.get(apigw_url) LOG.info("APIGW result %s", apigw_result) - cmd_list = self.get_logs_command_list(self.stack_name, name=apigw_name, beta_features=True) + cmd_list = self.get_logs_command_list(self.stack_name, name=apigw_name) self._check_logs(cmd_list, [f"HTTP Method: GET, Resource Path: /{path}"]) def _test_sfn_logs(self, state_machine_name): @@ -128,7 +128,7 @@ def _test_sfn_logs(self, state_machine_name): sfn_invoke_result = self.sfn_client.start_execution(stateMachineArn=sfn_physical_id) execution_arn = sfn_invoke_result.get("executionArn", "") LOG.info("SFN invoke result %s", sfn_invoke_result) - cmd_list = self.get_logs_command_list(self.stack_name, name=state_machine_name, beta_features=True) + cmd_list = self.get_logs_command_list(self.stack_name, name=state_machine_name) self._check_logs(cmd_list, [execution_arn]) def _test_end_to_end_apigw(self, apigw_name, path): @@ -137,7 +137,7 @@ def _test_end_to_end_apigw(self, apigw_name, path): apigw_url = f"{self._get_output_value(apigw_name_from_output)}{path}" apigw_result = requests.get(apigw_url) LOG.info("APIGW result %s", apigw_result) - cmd_list = self.get_logs_command_list(self.stack_name, beta_features=True) + cmd_list = self.get_logs_command_list(self.stack_name) self._check_logs( cmd_list, [ @@ -153,7 +153,7 @@ def _test_end_to_end_sfn(self, apigw_name, path): apigw_url = f"{self._get_output_value(apigw_name_from_output)}{path}" apigw_result = requests.get(apigw_url) LOG.info("APIGW result %s", apigw_result) - cmd_list = self.get_logs_command_list(self.stack_name, beta_features=True) + cmd_list = self.get_logs_command_list(self.stack_name) self._check_logs( cmd_list, [ @@ -169,7 +169,7 @@ def _test_output(self, function_name, output): LOG.info("Invoking function %s", function_name) lambda_invoke_result = self.lambda_client.invoke(FunctionName=self._get_physical_id(function_name)) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_logs_command_list(self.stack_name, name=function_name, output=output, beta_features=True) + cmd_list = self.get_logs_command_list(self.stack_name, name=function_name, output=output) self._check_logs(cmd_list, [expected_log_output], output=output) def _test_start_end(self, function_name, start_end_time_params): @@ -192,9 +192,7 @@ def _test_include_traces(self, function_name): LOG.info("Invoking function %s", function_name) lambda_invoke_result = self.lambda_client.invoke(FunctionName=self._get_physical_id(function_name)) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_logs_command_list( - self.stack_name, name=function_name, include_traces=True, beta_features=True - ) + cmd_list = self.get_logs_command_list(self.stack_name, name=function_name, include_traces=True) self._check_logs(cmd_list, ["New XRay Service Graph", "XRay Event [revision ", expected_log_output]) def _check_logs(self, cmd_list: List, log_strings: List[str], output: str = "text", retries=RETRY_COUNT): diff --git a/tests/integration/telemetry/test_experimental_metric.py b/tests/integration/telemetry/test_experimental_metric.py index 36111ddf3a..d9a829054d 100644 --- a/tests/integration/telemetry/test_experimental_metric.py +++ b/tests/integration/telemetry/test_experimental_metric.py @@ -2,6 +2,7 @@ import platform import time from pathlib import Path +from unittest import skip from unittest.mock import ANY from .integ_base import IntegBase, TelemetryServer @@ -13,6 +14,10 @@ class TestExperimentalMetric(IntegBase): Validates the basic tenets/contract Telemetry module needs to adhere to """ + @skip( + "Accelerate are not in experimental any more, just skip this test. If we have new experimental commands, " + "we can update this test" + ) def test_must_send_experimental_metrics_if_experimental_command(self): """ Metrics should be sent if "Disabled via config file but Enabled via Envvar" @@ -53,7 +58,6 @@ def test_must_send_experimental_metrics_if_experimental_command(self): "region": ANY, "commandName": ANY, "metricSpecificAttributes": { - "experimentalAccelerate": True, "experimentalAll": False, "experimentalEsbuild": False, }, @@ -67,6 +71,10 @@ def test_must_send_experimental_metrics_if_experimental_command(self): self.assertEqual(request["data"], expected_data) os.environ["SAM_CLI_BETA_ACCELERATE"] = "0" + @skip( + "Accelerate are not in experimental any more, just skip this test. If we have new experimental commands, " + "we can update this test" + ) def test_must_send_experimental_metrics_if_experimental_option(self): """ Metrics should be sent if "Disabled via config file but Enabled via Envvar" @@ -104,7 +112,6 @@ def test_must_send_experimental_metrics_if_experimental_option(self): "region": ANY, "commandName": ANY, "metricSpecificAttributes": { - "experimentalAccelerate": True, "experimentalAll": True, "experimentalEsbuild": True, }, diff --git a/tests/integration/traces/test_traces_command.py b/tests/integration/traces/test_traces_command.py index 896dd479b3..cc0ee89693 100644 --- a/tests/integration/traces/test_traces_command.py +++ b/tests/integration/traces/test_traces_command.py @@ -83,7 +83,7 @@ def test_function_traces(self, function_name): LOG.info("Invoking function %s", function_name) lambda_invoke_result = self.lambda_client.invoke(FunctionName=function_id) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_traces_command_list(beta_features=True) + cmd_list = self.get_traces_command_list() self._check_traces(cmd_list, expected_trace_output) @parameterized.expand([("ApiGwFunction",), ("SfnFunction",)]) @@ -111,7 +111,7 @@ def test_trace_id(self, function_name): trace_id = trace_summaries[0].get("Id") LOG.info("Trace id: %s", trace_id) - cmd_list = self.get_traces_command_list(trace_id=trace_id, beta_features=True) + cmd_list = self.get_traces_command_list(trace_id=trace_id) self._check_traces(cmd_list, expected_trace_output, has_service_graph=False) @parameterized.expand([("ApiGwFunction",), ("SfnFunction",)]) @@ -124,7 +124,7 @@ def test_trace_start_time(self, function_name): lambda_invoke_result = self.lambda_client.invoke(FunctionName=function_id) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_traces_command_list(start_time=str(start_time), beta_features=True) + cmd_list = self.get_traces_command_list(start_time=str(start_time)) self._check_traces(cmd_list, expected_trace_output) @parameterized.expand([("ApiGwFunction",), ("SfnFunction",)]) @@ -137,7 +137,7 @@ def test_trace_end_time(self, function_name): LOG.info("Lambda invoke result %s", lambda_invoke_result) end_time = datetime.utcnow() - cmd_list = self.get_traces_command_list(end_time=str(end_time), beta_features=True) + cmd_list = self.get_traces_command_list(end_time=str(end_time)) self._check_traces(cmd_list, expected_trace_output) @parameterized.expand([("ApiGwFunction",), ("SfnFunction",)]) @@ -149,7 +149,7 @@ def test_traces_with_tail(self, function_name: str): lambda_invoke_result = self.lambda_client.invoke(FunctionName=function_id) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_traces_command_list(tail=True, beta_features=True) + cmd_list = self.get_traces_command_list(tail=True) tail_process = start_persistent_process(cmd_list) def _check_traces(output: str, _: List[str]) -> bool: @@ -171,7 +171,7 @@ def test_traces_with_output_option(self, function_name, output): lambda_invoke_result = self.lambda_client.invoke(FunctionName=function_id) LOG.info("Lambda invoke result %s", lambda_invoke_result) - cmd_list = self.get_traces_command_list(output=output, beta_features=True) + cmd_list = self.get_traces_command_list(output=output) output_check = OutputOption.json if output == OutputOption.json.name else OutputOption.text self._check_traces(cmd_list, expected_trace_output, output=output_check) diff --git a/tests/integration/traces/traces_integ_base.py b/tests/integration/traces/traces_integ_base.py index 76cc2872ac..97afafda96 100644 --- a/tests/integration/traces/traces_integ_base.py +++ b/tests/integration/traces/traces_integ_base.py @@ -17,7 +17,6 @@ def get_traces_command_list( end_time: Optional[str] = None, tail: bool = False, output: Optional[str] = None, - beta_features: bool = False, ): command_list = [get_sam_command(), "traces"] @@ -31,7 +30,5 @@ def get_traces_command_list( command_list += ["--output", output] if tail: command_list += ["--tail"] - if beta_features: - command_list += ["--beta-features"] return command_list diff --git a/tests/unit/commands/_utils/test_experimental.py b/tests/unit/commands/_utils/test_experimental.py index 67709912cf..ed94cb35fc 100644 --- a/tests/unit/commands/_utils/test_experimental.py +++ b/tests/unit/commands/_utils/test_experimental.py @@ -59,13 +59,13 @@ def test_set_experimental(self): self.gc_mock.return_value.set_value.assert_called_once_with(config_entry, False, is_flag=True, flush=False) def test_get_all_experimental(self): - self.assertEqual(len(get_all_experimental()), 3) + self.assertEqual(len(get_all_experimental()), 2) def test_get_all_experimental_statues(self): - self.assertEqual(len(get_all_experimental_statues()), 3) + self.assertEqual(len(get_all_experimental_statues()), 2) def test_get_enabled_experimental_flags(self): - self.assertEqual(len(get_enabled_experimental_flags()), 3) + self.assertEqual(len(get_enabled_experimental_flags()), 2) @patch("samcli.commands._utils.experimental.set_experimental") @patch("samcli.commands._utils.experimental.get_all_experimental") diff --git a/tests/unit/commands/sync/test_command.py b/tests/unit/commands/sync/test_command.py index 08d162198b..5438131f2d 100644 --- a/tests/unit/commands/sync/test_command.py +++ b/tests/unit/commands/sync/test_command.py @@ -50,7 +50,6 @@ def setUp(self): @parameterized.expand([(False, False, True), (False, False, False)]) @patch("os.environ", {**os.environ, "SAM_CLI_POLL_DELAY": 10}) - @patch("samcli.commands.sync.command.update_experimental_context") @patch("samcli.commands.sync.command.click") @patch("samcli.commands.sync.command.execute_code_sync") @patch("samcli.commands.build.command.click") @@ -78,7 +77,6 @@ def test_infra_must_succeed_sync( mock_build_click, execute_code_sync_mock, click_mock, - update_experimental_context_mock, ): build_context_mock = Mock() @@ -183,7 +181,6 @@ def test_infra_must_succeed_sync( execute_code_sync_mock.assert_not_called() @parameterized.expand([(False, True, False)]) - @patch("samcli.commands.sync.command.update_experimental_context") @patch("samcli.commands.sync.command.click") @patch("samcli.commands.sync.command.execute_watch") @patch("samcli.commands.build.command.click") @@ -211,7 +208,6 @@ def test_watch_must_succeed_sync( mock_build_click, execute_watch_mock, click_mock, - update_experimental_context_mock, ): build_context_mock = Mock() @@ -314,7 +310,6 @@ def test_watch_must_succeed_sync( ) @parameterized.expand([(True, False, True)]) - @patch("samcli.commands.sync.command.update_experimental_context") @patch("samcli.commands.sync.command.click") @patch("samcli.commands.sync.command.execute_code_sync") @patch("samcli.commands.build.command.click") @@ -342,7 +337,6 @@ def test_code_must_succeed_sync( mock_build_click, execute_code_sync_mock, click_mock, - update_experimental_context_mock, ): build_context_mock = Mock() diff --git a/tests/unit/lib/build_module/test_build_strategy.py b/tests/unit/lib/build_module/test_build_strategy.py index 728026dae6..b72e983d38 100644 --- a/tests/unit/lib/build_module/test_build_strategy.py +++ b/tests/unit/lib/build_module/test_build_strategy.py @@ -565,17 +565,12 @@ def setUp(self) -> None: @parameterized.expand( [ - ("python3.7", True), - ("nodejs12.x", True), - ("ruby2.7", True), - ("python3.7", False), + "python3.7", + "nodejs12.x", + "ruby2.7", ] ) - @patch("samcli.lib.build.build_strategy.is_experimental_enabled") - def test_will_call_incremental_build_strategy( - self, mocked_read, mocked_write, runtime, experimental_enabled, patched_experimental - ): - patched_experimental.return_value = experimental_enabled + def test_will_call_incremental_build_strategy(self, mocked_read, mocked_write, runtime): build_definition = FunctionBuildDefinition(runtime, "codeuri", "packate_type", X86_64, {}, "handler") self.build_graph.put_function_build_definition(build_definition, Mock(full_path="function_full_path")) with patch.object( @@ -585,12 +580,8 @@ def test_will_call_incremental_build_strategy( ) as patched_cached_build_strategy: self.build_strategy.build() - if experimental_enabled: - patched_incremental_build_strategy.build_single_function_definition.assert_called_with(build_definition) - patched_cached_build_strategy.assert_not_called() - else: - patched_cached_build_strategy.build_single_function_definition.assert_called_with(build_definition) - patched_incremental_build_strategy.assert_not_called() + patched_incremental_build_strategy.build_single_function_definition.assert_called_with(build_definition) + patched_cached_build_strategy.assert_not_called() @parameterized.expand( [ @@ -662,10 +653,7 @@ def test_exit_build_strategy_for_specific_resource( ("nodejs", False), ] ) - @patch("samcli.lib.build.build_strategy.is_experimental_enabled") - def test_wrapper_with_or_without_container( - self, mocked_read, mocked_write, runtime, use_container, patched_experimental - ): + def test_wrapper_with_or_without_container(self, mocked_read, mocked_write, runtime, use_container): build_strategy = CachedOrIncrementalBuildStrategyWrapper( self.build_graph, Mock(), @@ -677,7 +665,6 @@ def test_wrapper_with_or_without_container( use_container, ) - patched_experimental.return_value = True build_definition = FunctionBuildDefinition(runtime, "codeuri", "packate_type", X86_64, {}, "handler") self.build_graph.put_function_build_definition(build_definition, Mock(full_path="function_full_path")) with patch.object( diff --git a/tests/unit/lib/observability/cw_logs/test_cw_log_group_provider.py b/tests/unit/lib/observability/cw_logs/test_cw_log_group_provider.py index d3f2bd71cd..19c4746f37 100644 --- a/tests/unit/lib/observability/cw_logs/test_cw_log_group_provider.py +++ b/tests/unit/lib/observability/cw_logs/test_cw_log_group_provider.py @@ -1,30 +1,25 @@ from unittest import TestCase -from unittest.mock import Mock, ANY, patch +from unittest.mock import Mock, ANY from parameterized import parameterized -from samcli.commands._utils.experimental import set_experimental, ExperimentalFlag from samcli.lib.observability.cw_logs.cw_log_group_provider import LogGroupProvider -@patch("samcli.commands._utils.experimental.update_experimental_context") class TestLogGroupProvider_for_lambda_function(TestCase): - def setUp(self) -> None: - set_experimental(config_entry=ExperimentalFlag.Accelerate, enabled=True) - - def test_must_return_log_group_name(self, patched_update_experimental_context): + def test_must_return_log_group_name(self): expected = "/aws/lambda/my_function_name" result = LogGroupProvider.for_lambda_function("my_function_name") self.assertEqual(expected, result) - def test_rest_api_log_group_name(self, patched_update_experimental_context): + def test_rest_api_log_group_name(self): expected = "API-Gateway-Execution-Logs_my_function_name/Prod" result = LogGroupProvider.for_resource(Mock(), "AWS::ApiGateway::RestApi", "my_function_name") self.assertEqual(expected, result) - def test_http_api_log_group_name(self, patched_update_experimental_context): + def test_http_api_log_group_name(self): given_client_provider = Mock() given_client_provider(ANY).get_stage.return_value = { "AccessLogSettings": {"DestinationArn": "test:my_log_group"} @@ -34,14 +29,14 @@ def test_http_api_log_group_name(self, patched_update_experimental_context): self.assertEqual(expected, result) - def test_http_api_log_group_name_not_exist(self, patched_update_experimental_context): + def test_http_api_log_group_name_not_exist(self): given_client_provider = Mock() given_client_provider(ANY).get_stage.return_value = {} result = LogGroupProvider.for_resource(given_client_provider, "AWS::ApiGatewayV2::Api", "my_function_name") self.assertIsNone(result) - def test_step_functions(self, patched_update_experimental_context): + def test_step_functions(self): given_client_provider = Mock() given_cw_log_group_name = "sam-app-logs-command-test-MyStateMachineLogGroup-ucwMaQpNBJTD" given_client_provider(ANY).describe_state_machine.return_value = { @@ -63,7 +58,7 @@ def test_step_functions(self, patched_update_experimental_context): self.assertIsNotNone(result) self.assertEqual(result, given_cw_log_group_name) - def test_invalid_step_functions(self, patched_update_experimental_context): + def test_invalid_step_functions(self): given_client_provider = Mock() given_client_provider(ANY).describe_state_machine.return_value = {"loggingConfiguration": {"destinations": []}} @@ -74,7 +69,7 @@ def test_invalid_step_functions(self, patched_update_experimental_context): self.assertIsNone(result) @parameterized.expand(["non-ARN-log-group", "invalid:log:arn"]) - def test_invalid_step_functions_configuration(self, patched_update_experimental_context, log_group_arn): + def test_invalid_step_functions_configuration(self, log_group_arn): given_client_provider = Mock() given_client_provider(ANY).describe_state_machine.return_value = { "loggingConfiguration": {"destinations": [{"cloudWatchLogsLogGroup": {"logGroupArn": log_group_arn}}]}