Skip to content
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

refactor: DBTP-1630 - copilot environment domain tests #716

Merged
merged 89 commits into from
Jan 24, 2025

Conversation

ksugden
Copy link
Contributor

@ksugden ksugden commented Jan 13, 2025

Addresses DBTP-1630

Refactor of copilot environment domain to align with pattern set in Terraform environment.


Checklist:

Title:

  • Scope included as per conventional commits
  • Ticket reference included (unless it's a quick out of ticket thing)

Description:

  • Link to ticket included (unless it's a quick out of ticket thing)
  • Includes tests (or an explanation for why it doesn't)
    - [ ] If the work includes user interface changes, before and after screenshots included in description
    - [ ] Includes any applicable changes to the documentation in this code base
    - [ ] Includes link(s) to any applicable changes to the documentation in the [DBT Platform Documentation](https://platform.readme.trade.gov.uk/) (can be to a pull request)

Tasks:

)
def test_copilot_templating_generate_generates_expected_manifest(self, mock_get_cert_arn):
mock_file_provider = Mock()
mock_file_provider.mkfile.return_value = "im a file provider!"
Copy link
Contributor Author

@ksugden ksugden Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mock return value is only needed to assert on the writing part, which isn't needed for this test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot lol

@@ -8,7 +8,7 @@


class CloudFormation:
def __init__(self, cloudformation_client, iam_client, ssm_client):
def __init__(self, cloudformation_client, iam_client=None, ssm_client=None):
Copy link
Contributor Author

@ksugden ksugden Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I like being able to initialise this class with or without iam and ssm clients, though I see these clients are only needed for certain functionalities... maybe a better pattern here would be to pass in the session and then the clients can be created when needed. Something to return to when we consolidate the way we're handling boto3 stuff I guess. Maybe could add a TODO? Or at least we should raise an exception if one of the functions is called without the client being there? e.g. if we try CloudFormation(cloudformation_client).add_stack_delete_policy_to_task_role

# "dbt_platform_helper.domain.copilot_environment.get_https_listener_for_application",
# return_value="https_listener_arn",
# )
# def test_when_no_certificate_present(self, mock_get_https_listener_for_application):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we removing this test?

@DeveloperConnor DeveloperConnor merged commit 15e80e5 into main Jan 24, 2025
10 checks passed
@DeveloperConnor DeveloperConnor deleted the DBTP-1630-copilot-environment-tests branch January 24, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants