From e6dfce3f653fb3ce024b62adeada18c06495e5d2 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Mon, 17 Oct 2022 16:51:36 -0700 Subject: [PATCH 01/11] Script to add transform tests Remove unused import Address Feedback Format file Run sam-translate as a script Use main Address Feedback --- bin/add_transform_test.py | 138 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 bin/add_transform_test.py diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py new file mode 100644 index 0000000000..7137aaeaa6 --- /dev/null +++ b/bin/add_transform_test.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python +"""Automatically create transform tests input and output files given an input template. + +Usage: + add_transform_test.py --template-file=sam-template.yaml [--disable-api-configuration] + add_transform_test.py --template-file=sam-template.yaml + +Options: + --template-file= Location of SAM template to transform [default: template.yaml]. + --disable-api-configuration Disable adding REGIONAL configuration to AWS::ApiGateway::RestApi +""" +import json +import subprocess +import re +import os +import shutil +import yaml +import tempfile +from docopt import docopt +from pathlib import Path +from typing import Any + +from samtranslator.yaml_helper import yaml_parse + +cwd = os.getcwd() +CLI_OPTIONS = docopt(__doc__) + + +def get_input_file_path() -> str: + input_file_option = CLI_OPTIONS.get("--template-file") + return os.path.join(cwd, input_file_option) + + +def copy_input_file_to_transform_test_dir(input_file_path: str, transform_test_input_path: str) -> None: + shutil.copyfile(input_file_path, transform_test_input_path) + + replace_arn_partitions(transform_test_input_path) + print(f"Transform Test input file generated {transform_test_input_path}") + + +def add_regional_endpoint_configuration_if_needed(temp_output_file_path: str) -> None: + with open(temp_output_file_path, "r") as f: + sam_template = json.load(f) + + for logical_id, resource in sam_template["Resources"].items(): + if resource["Type"] == "AWS::ApiGateway::RestApi": + if "EndpointConfiguration" not in resource["Properties"]: + sam_template["Resources"][logical_id]["Properties"]["EndpointConfiguration"] = {"Types": ["REGIONAL"]} + if "Parameters" not in resource["Properties"]: + sam_template["Resources"][logical_id]["Properties"]["Parameters"] = { + "endpointConfigurationTypes": "REGIONAL" + } + + with open(temp_output_file_path, "w") as f: + json.dump(sam_template, f, indent=2) + + +def generate_transform_test_output_files(input_file_path: str, file_basename: str) -> None: + output_file_option = file_basename + ".json" + + # run sam-translate.py and get the temporary output file + with tempfile.NamedTemporaryFile() as temp_output_file: + subprocess.run( + [ + "python", + os.path.dirname(os.path.realpath(__file__)) + "/sam-translate.py", + "--template-file", + input_file_path, + "--output-template", + temp_output_file.name, + ], + check=True, + ) + + # copy the output files into correct directories + transform_test_output_path = cwd + "/tests/translator/output/" + output_file_option + shutil.copyfile(temp_output_file.name, transform_test_output_path) + + regional_transform_test_output_paths = [ + cwd + path + output_file_option + for path in [ + "/tests/translator/output/aws-cn/", + "/tests/translator/output/aws-us-gov/", + ] + ] + + if not CLI_OPTIONS.get("--disable-api-configuration"): + add_regional_endpoint_configuration_if_needed(temp_output_file.name) + + for output_path in regional_transform_test_output_paths: + shutil.copyfile(temp_output_file.name, output_path) + print(f"Transform Test output files generated {output_path}") + + +def map_nested(obj: Any, fn) -> Any: + if isinstance(obj, dict): + return {k: map_nested(v, fn) for k, v in obj.items()} + if isinstance(obj, list): + return [map_nested(v, fn) for v in obj] + return fn(obj) + + +def replace_arn(s: Any) -> Any: + if not isinstance(s, str): + return s + + pattern = "arn:aws:" + replaced_pattern = "arn:${AWS::Partition}" + if pattern in s: + # pattern is substring of s, use Fn::Sub to replace part of s + s = s.replace(pattern, replaced_pattern) + if re.search(r"\${.+}", s): + return {"Fn::Sub": s} + return s + + +def replace_arn_partitions(input_file_path: str) -> None: + with open(input_file_path, "r") as f: + sam_template = yaml_parse(f) + + replaced_template = map_nested(sam_template, lambda v: replace_arn(v)) + + with open(input_file_path, "w") as f: + yaml.dump(replaced_template, f, default_flow_style=False) + + +def main() -> None: + input_file_path = get_input_file_path() + file_basename = Path(input_file_path).stem + + transform_test_input_path = cwd + "/tests/translator/input/" + file_basename + ".yaml" + copy_input_file_to_transform_test_dir(input_file_path, transform_test_input_path) + + generate_transform_test_output_files(transform_test_input_path, file_basename) + + +if __name__ == "__main__": + main() From 52e2e75d60e87b6660b56f94466601e11e123a22 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 13:53:15 -0700 Subject: [PATCH 02/11] Address Feedback --- bin/add_transform_test.py | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 7137aaeaa6..9107dd359e 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -18,17 +18,18 @@ import tempfile from docopt import docopt from pathlib import Path -from typing import Any +from typing import Any, Dict from samtranslator.yaml_helper import yaml_parse -cwd = os.getcwd() +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) +TRANSFORM_TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + "/../tests/translator/" CLI_OPTIONS = docopt(__doc__) def get_input_file_path() -> str: input_file_option = CLI_OPTIONS.get("--template-file") - return os.path.join(cwd, input_file_option) + return os.path.join(os.getcwd(), input_file_option) def copy_input_file_to_transform_test_dir(input_file_path: str, transform_test_input_path: str) -> None: @@ -38,21 +39,27 @@ def copy_input_file_to_transform_test_dir(input_file_path: str, transform_test_i print(f"Transform Test input file generated {transform_test_input_path}") -def add_regional_endpoint_configuration_if_needed(temp_output_file_path: str) -> None: - with open(temp_output_file_path, "r") as f: +def read_json_file(file_path: str) -> Dict[str, Any]: + with open(file_path, "r") as f: sam_template = json.load(f) + return sam_template - for logical_id, resource in sam_template["Resources"].items(): + +def write_json_file(obj: Dict[str, Any], file_path: str) -> None: + with open(file_path, "w") as f: + json.dump(obj, f, indent=2) + + +def add_regional_endpoint_configuration_if_needed(template: Dict[str, Any]) -> None: + for _, resource in template["Resources"].items(): if resource["Type"] == "AWS::ApiGateway::RestApi": - if "EndpointConfiguration" not in resource["Properties"]: - sam_template["Resources"][logical_id]["Properties"]["EndpointConfiguration"] = {"Types": ["REGIONAL"]} - if "Parameters" not in resource["Properties"]: - sam_template["Resources"][logical_id]["Properties"]["Parameters"] = { - "endpointConfigurationTypes": "REGIONAL" - } + properties = resource["Properties"] + if "EndpointConfiguration" not in properties: + properties["EndpointConfiguration"] = {"Types": ["REGIONAL"]} + if "Parameters" not in properties: + properties["Parameters"] = {"endpointConfigurationTypes": "REGIONAL"} - with open(temp_output_file_path, "w") as f: - json.dump(sam_template, f, indent=2) + return template def generate_transform_test_output_files(input_file_path: str, file_basename: str) -> None: @@ -63,7 +70,7 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st subprocess.run( [ "python", - os.path.dirname(os.path.realpath(__file__)) + "/sam-translate.py", + SCRIPT_DIR + "/sam-translate.py", "--template-file", input_file_path, "--output-template", @@ -73,19 +80,21 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st ) # copy the output files into correct directories - transform_test_output_path = cwd + "/tests/translator/output/" + output_file_option + transform_test_output_path = TRANSFORM_TEST_DIR + "/output/" + output_file_option shutil.copyfile(temp_output_file.name, transform_test_output_path) regional_transform_test_output_paths = [ - cwd + path + output_file_option + TRANSFORM_TEST_DIR + path + output_file_option for path in [ - "/tests/translator/output/aws-cn/", - "/tests/translator/output/aws-us-gov/", + "/output/aws-cn/", + "/output/aws-us-gov/", ] ] if not CLI_OPTIONS.get("--disable-api-configuration"): - add_regional_endpoint_configuration_if_needed(temp_output_file.name) + template = read_json_file(temp_output_file.name) + template = add_regional_endpoint_configuration_if_needed(template) + write_json_file(template, temp_output_file.name) for output_path in regional_transform_test_output_paths: shutil.copyfile(temp_output_file.name, output_path) @@ -128,7 +137,7 @@ def main() -> None: input_file_path = get_input_file_path() file_basename = Path(input_file_path).stem - transform_test_input_path = cwd + "/tests/translator/input/" + file_basename + ".yaml" + transform_test_input_path = TRANSFORM_TEST_DIR + "/input/" + file_basename + ".yaml" copy_input_file_to_transform_test_dir(input_file_path, transform_test_input_path) generate_transform_test_output_files(transform_test_input_path, file_basename) From f1dbefcc13321bf77fd7e9d60a08409db454fbbb Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 13:58:01 -0700 Subject: [PATCH 03/11] Use sys.executable --- bin/add_transform_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 9107dd359e..9be04868a8 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -14,6 +14,7 @@ import re import os import shutil +import sys import yaml import tempfile from docopt import docopt @@ -69,7 +70,7 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st with tempfile.NamedTemporaryFile() as temp_output_file: subprocess.run( [ - "python", + sys.executable, SCRIPT_DIR + "/sam-translate.py", "--template-file", input_file_path, From d9d65b98dc8555d728dc683296f1bd3b7ceb4e67 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 18 Oct 2022 14:00:41 -0700 Subject: [PATCH 04/11] Update bin/add_transform_test.py Co-authored-by: Chris Rehn <1280602+hoffa@users.noreply.github.com> --- bin/add_transform_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 9be04868a8..cd101a4a10 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -24,7 +24,7 @@ from samtranslator.yaml_helper import yaml_parse SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -TRANSFORM_TEST_DIR = os.path.dirname(os.path.realpath(__file__)) + "/../tests/translator/" +TRANSFORM_TEST_DIR = SCRIPT_DIR + "/../tests/translator" CLI_OPTIONS = docopt(__doc__) From b919df472ef67acbbe5b8703c2b2231b48161d87 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 14:31:29 -0700 Subject: [PATCH 05/11] use path.join --- Makefile | 2 + bin/add_transform_test.py | 87 ++++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index eba770f597..a233a5a02e 100755 --- a/Makefile +++ b/Makefile @@ -28,6 +28,8 @@ lint: pylint --rcfile .pylintrc samtranslator # mypy performs type check mypy samtranslator + # Add --ignore-missing-imports flag to address Skipping analyzing "docopt": module is installed, but missing library stubs or py.typed marker + mypy bin/add_transform_test.py --ignore-missing-imports prepare-companion-stack: pytest -v --no-cov integration/setup -m setup diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index cd101a4a10..025fb74eb1 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -24,25 +24,46 @@ from samtranslator.yaml_helper import yaml_parse SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -TRANSFORM_TEST_DIR = SCRIPT_DIR + "/../tests/translator" +TRANSFORM_TEST_DIR = os.path.join(SCRIPT_DIR, "../tests/translator") CLI_OPTIONS = docopt(__doc__) -def get_input_file_path() -> str: - input_file_option = CLI_OPTIONS.get("--template-file") - return os.path.join(os.getcwd(), input_file_option) +def map_nested(obj: Any, fn) -> Any: + if isinstance(obj, dict): + return {k: map_nested(v, fn) for k, v in obj.items()} + if isinstance(obj, list): + return [map_nested(v, fn) for v in obj] + return fn(obj) -def copy_input_file_to_transform_test_dir(input_file_path: str, transform_test_input_path: str) -> None: - shutil.copyfile(input_file_path, transform_test_input_path) +def replace_arn(s: Any) -> Any: + if not isinstance(s, str): + return s + + pattern = "arn:aws:" + replaced_pattern = "arn:${AWS::Partition}" + if pattern in s: + # pattern is substring of s, use Fn::Sub to replace part of s + s = s.replace(pattern, replaced_pattern) + if re.search(r"\${.+}", s): + return {"Fn::Sub": s} + return s + + +def replace_arn_partitions(input_file_path: str) -> None: + with open(input_file_path, "r") as f: + sam_template = yaml_parse(f) + + replaced_template = map_nested(sam_template, lambda v: replace_arn(v)) + + with open(input_file_path, "w") as f: + yaml.dump(replaced_template, f, default_flow_style=False) - replace_arn_partitions(transform_test_input_path) - print(f"Transform Test input file generated {transform_test_input_path}") def read_json_file(file_path: str) -> Dict[str, Any]: with open(file_path, "r") as f: - sam_template = json.load(f) + sam_template: Dict[str, Any] = json.load(f) return sam_template @@ -51,7 +72,7 @@ def write_json_file(obj: Dict[str, Any], file_path: str) -> None: json.dump(obj, f, indent=2) -def add_regional_endpoint_configuration_if_needed(template: Dict[str, Any]) -> None: +def add_regional_endpoint_configuration_if_needed(template: Dict[str, Any]) -> Dict[str, Any]: for _, resource in template["Resources"].items(): if resource["Type"] == "AWS::ApiGateway::RestApi": properties = resource["Properties"] @@ -71,7 +92,7 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st subprocess.run( [ sys.executable, - SCRIPT_DIR + "/sam-translate.py", + os.path.join(SCRIPT_DIR, "sam-translate.py"), "--template-file", input_file_path, "--output-template", @@ -81,14 +102,14 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st ) # copy the output files into correct directories - transform_test_output_path = TRANSFORM_TEST_DIR + "/output/" + output_file_option + transform_test_output_path = os.path.join(TRANSFORM_TEST_DIR, "output/", output_file_option) shutil.copyfile(temp_output_file.name, transform_test_output_path) regional_transform_test_output_paths = [ - TRANSFORM_TEST_DIR + path + output_file_option + os.path.join(TRANSFORM_TEST_DIR, path, output_file_option) for path in [ - "/output/aws-cn/", - "/output/aws-us-gov/", + "output/aws-cn/", + "output/aws-us-gov/", ] ] @@ -102,43 +123,23 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st print(f"Transform Test output files generated {output_path}") -def map_nested(obj: Any, fn) -> Any: - if isinstance(obj, dict): - return {k: map_nested(v, fn) for k, v in obj.items()} - if isinstance(obj, list): - return [map_nested(v, fn) for v in obj] - return fn(obj) - - -def replace_arn(s: Any) -> Any: - if not isinstance(s, str): - return s - - pattern = "arn:aws:" - replaced_pattern = "arn:${AWS::Partition}" - if pattern in s: - # pattern is substring of s, use Fn::Sub to replace part of s - s = s.replace(pattern, replaced_pattern) - if re.search(r"\${.+}", s): - return {"Fn::Sub": s} - return s +def get_input_file_path() -> str: + input_file_option = CLI_OPTIONS.get("--template-file") + return os.path.join(os.getcwd(), input_file_option) -def replace_arn_partitions(input_file_path: str) -> None: - with open(input_file_path, "r") as f: - sam_template = yaml_parse(f) - - replaced_template = map_nested(sam_template, lambda v: replace_arn(v)) +def copy_input_file_to_transform_test_dir(input_file_path: str, transform_test_input_path: str) -> None: + shutil.copyfile(input_file_path, transform_test_input_path) - with open(input_file_path, "w") as f: - yaml.dump(replaced_template, f, default_flow_style=False) + replace_arn_partitions(transform_test_input_path) + print(f"Transform Test input file generated {transform_test_input_path}") def main() -> None: input_file_path = get_input_file_path() file_basename = Path(input_file_path).stem - transform_test_input_path = TRANSFORM_TEST_DIR + "/input/" + file_basename + ".yaml" + transform_test_input_path = os.path.join(TRANSFORM_TEST_DIR, "input/", file_basename + ".yaml") copy_input_file_to_transform_test_dir(input_file_path, transform_test_input_path) generate_transform_test_output_files(transform_test_input_path, file_basename) From fc88d90f75c55e0f5da6d3ceca572e23150546d6 Mon Sep 17 00:00:00 2001 From: _sam <3804518+aahung@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:33:11 -0700 Subject: [PATCH 06/11] Update bin/add_transform_test.py Co-authored-by: Chris Rehn <1280602+hoffa@users.noreply.github.com> --- bin/add_transform_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 025fb74eb1..441db29c49 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -139,7 +139,7 @@ def main() -> None: input_file_path = get_input_file_path() file_basename = Path(input_file_path).stem - transform_test_input_path = os.path.join(TRANSFORM_TEST_DIR, "input/", file_basename + ".yaml") + transform_test_input_path = os.path.join(TRANSFORM_TEST_DIR, "input", file_basename + ".yaml") copy_input_file_to_transform_test_dir(input_file_path, transform_test_input_path) generate_transform_test_output_files(transform_test_input_path, file_basename) From 2a022c9d0b0e0909bac32b51a700b94a637e72c9 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 18 Oct 2022 14:34:22 -0700 Subject: [PATCH 07/11] Update bin/add_transform_test.py Co-authored-by: Chris Rehn <1280602+hoffa@users.noreply.github.com> --- bin/add_transform_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 441db29c49..a40f50672c 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -102,7 +102,7 @@ def generate_transform_test_output_files(input_file_path: str, file_basename: st ) # copy the output files into correct directories - transform_test_output_path = os.path.join(TRANSFORM_TEST_DIR, "output/", output_file_option) + transform_test_output_path = os.path.join(TRANSFORM_TEST_DIR, "output", output_file_option) shutil.copyfile(temp_output_file.name, transform_test_output_path) regional_transform_test_output_paths = [ From 612c9636271fb98d8598f93e9dfc52fb52f6f539 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 14:36:34 -0700 Subject: [PATCH 08/11] Format file --- bin/add_transform_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index a40f50672c..92c1428d90 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -60,7 +60,6 @@ def replace_arn_partitions(input_file_path: str) -> None: yaml.dump(replaced_template, f, default_flow_style=False) - def read_json_file(file_path: str) -> Dict[str, Any]: with open(file_path, "r") as f: sam_template: Dict[str, Any] = json.load(f) From 9987c4a2d8cc13d507a8c5a93065e737ad95d387 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 14:38:11 -0700 Subject: [PATCH 09/11] Ignore type --- Makefile | 4 +--- bin/add_transform_test.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a233a5a02e..7ac27c4f03 100755 --- a/Makefile +++ b/Makefile @@ -27,9 +27,7 @@ lint: # Linter performs static analysis to catch latent bugs pylint --rcfile .pylintrc samtranslator # mypy performs type check - mypy samtranslator - # Add --ignore-missing-imports flag to address Skipping analyzing "docopt": module is installed, but missing library stubs or py.typed marker - mypy bin/add_transform_test.py --ignore-missing-imports + mypy samtranslator bin/add_transform_test.py prepare-companion-stack: pytest -v --no-cov integration/setup -m setup diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index 92c1428d90..d56da76d59 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -17,7 +17,7 @@ import sys import yaml import tempfile -from docopt import docopt +from docopt import docopt # type: ignore from pathlib import Path from typing import Any, Dict From 17dd1b216364aa10a853cd7050fe2ce82533ea57 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 14:50:28 -0700 Subject: [PATCH 10/11] Add to DEVELOPMENT_GUIDE --- DEVELOPMENT_GUIDE.md | 21 ++++++++++++++++++++- bin/add_transform_test.py | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/DEVELOPMENT_GUIDE.md b/DEVELOPMENT_GUIDE.md index d260c6c70a..3865fa3b36 100644 --- a/DEVELOPMENT_GUIDE.md +++ b/DEVELOPMENT_GUIDE.md @@ -127,6 +127,25 @@ will not work in Python3.6). If you want to test in many versions, you can creat each version and flip between them (sourcing the activate script). Typically, we run all tests in one python version locally and then have our ci (appveyor) run all supported versions. +### Transform tests +When adding new transform tests, we have provided a script to help generate the transform test input +and output files in the correct directory given a template.yaml file. +```bash +python3 bin/add_transform_test.py --template-file template.yaml +``` + +This script will automatically generate the input and output files. It will guarantee that the output +files have the correct AWS partition (e.g. aws-cn, aws-us-gov). + +For `AWS::ApiGateway::RestApi`, the script will automatically append `REGIONAL` EndpointConfiguration. +To disable this feature, run the following command instead. +```bash +python3 bin/add_transform_test.py --template-file template.yaml --disable-api-configuration +``` + +Note that please always check the generated output is as expected. This tool does not guarantee correct output. + + ### Integration tests Integration tests are covered in detail in the [INTEGRATION_TESTS.md file](INTEGRATION_TESTS.md) of this repository. @@ -184,4 +203,4 @@ bin/sam-translate.py --template-file=output-template.yaml # Deploy your transformed CloudFormation template # Replace MY_STACK_NAME with a unique name each time you deploy aws cloudformation deploy --template-file cfn-template.json --capabilities CAPABILITY_NAMED_IAM --stack-name MY_STACK_NAME - ``` \ No newline at end of file +``` \ No newline at end of file diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index d56da76d59..e06e03f4df 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -143,6 +143,10 @@ def main() -> None: generate_transform_test_output_files(transform_test_input_path, file_basename) + print( + "Generating transform test input and output files complete. \n\nPlease check the generated output is as expected. This tool does not guarantee correct output." + ) + if __name__ == "__main__": main() From 1271e4891091bf09cbca6edbd8241448b166a5b6 Mon Sep 17 00:00:00 2001 From: Gavin Zhang Date: Tue, 18 Oct 2022 14:51:19 -0700 Subject: [PATCH 11/11] Update path --- bin/add_transform_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/add_transform_test.py b/bin/add_transform_test.py index e06e03f4df..edf77dbb6c 100644 --- a/bin/add_transform_test.py +++ b/bin/add_transform_test.py @@ -24,7 +24,7 @@ from samtranslator.yaml_helper import yaml_parse SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -TRANSFORM_TEST_DIR = os.path.join(SCRIPT_DIR, "../tests/translator") +TRANSFORM_TEST_DIR = os.path.join(SCRIPT_DIR, "..", "tests", "translator") CLI_OPTIONS = docopt(__doc__)