diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ddf842..8877b253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### **Changed** +- add integration tests for `sagemaker-studio` - bump ecr module version to 1.10.0 to consume auto-delete images feature ## v1.3.0 diff --git a/modules/sagemaker/sagemaker-studio/deployspec.yaml b/modules/sagemaker/sagemaker-studio/deployspec.yaml index 534249bf..028e8124 100644 --- a/modules/sagemaker/sagemaker-studio/deployspec.yaml +++ b/modules/sagemaker/sagemaker-studio/deployspec.yaml @@ -3,7 +3,7 @@ deploy: phases: install: commands: - - npm install -g aws-cdk@2.128.0 + - npm install -g aws-cdk@2.149.0 - pip install -r requirements.txt - apt-get install gettext-base build: @@ -28,7 +28,7 @@ destroy: phases: install: commands: - - npm install -g aws-cdk@2.128.0 + - npm install -g aws-cdk@2.149.0 - pip install -r requirements.txt build: commands: diff --git a/modules/sagemaker/sagemaker-studio/integ/integ_studio.py b/modules/sagemaker/sagemaker-studio/integ/integ_studio.py new file mode 100644 index 00000000..5b4e9f47 --- /dev/null +++ b/modules/sagemaker/sagemaker-studio/integ/integ_studio.py @@ -0,0 +1,65 @@ +import json +import os +import sys +from typing import Dict, List + +import aws_cdk as cdk +import boto3 +from aws_cdk import cloud_assembly_schema as cas +from aws_cdk import integ_tests_alpha as integration + +sys.path.append("../") + +import stack # noqa: E402 + +app = cdk.App() + + +def get_module_dependencies(resource_keys: List[str]) -> Dict[str, str]: + ssm = boto3.client("ssm", region_name="us-east-1") + dependencies = {} + try: + for key in resource_keys: + dependencies[key] = ssm.get_parameter(Name=f"/module-integration-tests/{key}")["Parameter"]["Value"] + except Exception as e: + print(f"issue getting dependencies: {e}") + return dependencies + + +dependencies = get_module_dependencies( + # Add any required resource identifiers here + resource_keys=["vpc-id", "vpc-private-subnets"] +) + +studio_stack = stack.SagemakerStudioStack( + app, + "sagemaker-studio-integ-stack", + vpc_id=dependencies["vpc-id"], + subnet_ids=json.loads(dependencies["vpc-private-subnets"]), + studio_domain_name="test-domain", + studio_bucket_name="test-bucket", + data_science_users=["ds-user-1"], + lead_data_science_users=["lead-ds-user-1"], + app_image_config_name=None, + image_name=None, + enable_custom_sagemaker_projects=False, + enable_domain_resource_isolation=True, + auth_mode="IAM", + env=cdk.Environment(account=os.getenv("CDK_DEFAULT_ACCOUNT"), region="us-east-1"), +) + +integration.IntegTest( + app, + "Integration Tests SageMaker Studio Module", + test_cases=[ + studio_stack, + ], + diff_assets=True, + stack_update_workflow=True, + enable_lookups=True, + cdk_command_options=cas.CdkCommands( + deploy=cas.DeployCommand(args=cas.DeployOptions(require_approval=cas.RequireApproval.NEVER, json=True)), + destroy=cas.DestroyCommand(args=cas.DestroyOptions(force=True)), + ), +) +app.synth() diff --git a/modules/sagemaker/sagemaker-studio/requirements.txt b/modules/sagemaker/sagemaker-studio/requirements.txt index 67cec470..c7d80d05 100644 --- a/modules/sagemaker/sagemaker-studio/requirements.txt +++ b/modules/sagemaker/sagemaker-studio/requirements.txt @@ -1,5 +1,6 @@ -aws-cdk-lib==2.128.0 -aws_cdk.aws_lambda_python_alpha==2.128.0a0 -cdk-nag==2.28.40 -pydantic~=2.7.1 -pydantic-settings~=2.2.1 +aws-cdk-lib~=2.149.0 +aws_cdk.aws_lambda_python_alpha~=2.149.0a0 +aws_cdk.integ-tests-alpha~=2.149.0a0 +cdk-nag~=2.28.160 +pydantic~=2.8.2 +pydantic-settings~=2.3.4