Skip to content

Commit

Permalink
update tests for sagemaker-studio
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonLuttenberger committed Mar 11, 2024
1 parent 950e0bc commit 787e0f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 0 additions & 12 deletions modules/sagemaker/sagemaker-studio/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,6 @@ def enable_sagemaker_projects(self, roles: List[str]) -> None:
),
],
)
cdk_nag.NagSuppressions.add_resource_suppressions(
[event_handler, provider],
apply_to_children=True,
suppressions=[
cdk_nag.NagPackSuppression(
id="AwsSolutions-L1",
reason=(
"We don't want customer deployments to start failing when a new version of Python comes out."
),
),
],
)

def sagemaker_studio_domain(
self,
Expand Down
9 changes: 5 additions & 4 deletions modules/sagemaker/sagemaker-studio/tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def stack_defaults() -> None:


@pytest.fixture(scope="function")
def stack(stack_defaults) -> cdk.Stack:
def stack(stack_defaults, enable_custom_sagemaker_projects: bool) -> cdk.Stack:
import stack

app = cdk.App()
Expand All @@ -34,7 +34,6 @@ def stack(stack_defaults) -> cdk.Stack:
lead_data_science_users = ["lead-ds-user-1"]
app_image_config_name = None
image_name = None
enable_custom_sagemaker_projects = False

return stack.SagemakerStudioStack(
app,
Expand All @@ -58,7 +57,8 @@ def stack(stack_defaults) -> cdk.Stack:
)


def test_synthesize_stack(stack: cdk.Stack) -> None:
@pytest.mark.parametrize("enable_custom_sagemaker_projects", [True, False])
def test_synthesize_stack(stack: cdk.Stack, enable_custom_sagemaker_projects: bool) -> None:
template = Template.from_stack(stack)

template.resource_count_is("AWS::SageMaker::Domain", 1)
Expand All @@ -67,7 +67,8 @@ def test_synthesize_stack(stack: cdk.Stack) -> None:
template.resource_count_is("AWS::IAM::Role", 3)


def test_no_cdk_nag_errors(stack: cdk.Stack) -> None:
@pytest.mark.parametrize("enable_custom_sagemaker_projects", [True, False])
def test_no_cdk_nag_errors(stack: cdk.Stack, enable_custom_sagemaker_projects: bool) -> None:
cdk.Aspects.of(stack).add(cdk_nag.AwsSolutionsChecks())

nag_errors = Annotations.from_stack(stack).find_error(
Expand Down

0 comments on commit 787e0f1

Please sign in to comment.