Skip to content

Commit

Permalink
Add logging for canary auto generation
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-1010 committed Jun 24, 2024
1 parent d17ac7d commit 7e6603c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rpdk/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,9 +1323,12 @@ def generate_canary_files(self) -> None:
not self.file_generation_enabled
or not Path(self.target_contract_test_folder_path).exists()
):
LOG.info("Skipping Canary Auto-Generation")
return
LOG.info("Starting Canary Auto-Generation...")
self._setup_stack_template_environment()
self._generate_stack_template_files()
LOG.info("Finished Canary Auto-Generation")

def _setup_stack_template_environment(self) -> None:
stack_template_root = Path(self.target_canary_root_path)
Expand All @@ -1337,7 +1340,12 @@ def _setup_stack_template_environment(self) -> None:
)
bootstrap_file = stack_template_root / CANARY_DEPENDENCY_FILE_NAME
if dependencies_file.exists():
LOG.debug("Writing: %s", bootstrap_file)
shutil.copy(str(dependencies_file), str(bootstrap_file))
else:
LOG.debug(
"Not found: %s. Not writing to: %s", dependencies_file, bootstrap_file
)

def _generate_stack_template_files(self) -> None:
stack_template_folder = Path(self.target_canary_folder_path)
Expand All @@ -1349,6 +1357,7 @@ def _generate_stack_template_files(self) -> None:
]
contract_test_files = sorted(contract_test_files)
for count, ct_file in enumerate(contract_test_files, start=1):
LOG.debug("Loading contract test input file: %s", ct_file)
with ct_file.open("r") as f:
json_data = json.load(f)
resource_name = self.type_info[2]
Expand Down Expand Up @@ -1398,6 +1407,7 @@ def _save_stack_template_data(
f"{CANARY_FILE_PREFIX}{contract_test_input_count}_{suffix}.yaml"
)
stack_template_file_path = stack_template_folder / stack_template_file_name
LOG.debug("Writing Canary Stack Template File: %s", stack_template_file_path)
with stack_template_file_path.open("w") as stack_template_file:
yaml.dump(stack_template_data, stack_template_file, indent=2)

Expand Down

0 comments on commit 7e6603c

Please sign in to comment.