Skip to content

change: make test's custom bucket include region and account name. #1183

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

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions tests/integ/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@

from sagemaker.processing import ProcessingInput, ProcessingOutput, ScriptProcessor, Processor
from sagemaker.sklearn.processing import SKLearnProcessor
from sagemaker.utils import sts_regional_endpoint
from tests.integ import DATA_DIR
from tests.integ.kms_utils import get_or_create_kms_key

ROLE = "SageMakerRole"
DEFAULT_REGION = "us-west-2"
CUSTOM_BUCKET_PATH = "sagemaker-custom-bucket"
CUSTOM_BUCKET_PATH_PREFIX = "sagemaker-custom-bucket"


@pytest.fixture(scope="module")
Expand All @@ -49,11 +50,17 @@ def sagemaker_session_with_custom_bucket(
else None
)

region = boto_session.region_name
account = boto_session.client(
"sts", region_name=region, endpoint_url=sts_regional_endpoint(region)
).get_caller_identity()["Account"]
custom_default_bucket = "{}-{}-{}".format(CUSTOM_BUCKET_PATH_PREFIX, region, account)

return Session(
boto_session=boto_session,
sagemaker_client=sagemaker_client,
sagemaker_runtime_client=runtime_client,
default_bucket=CUSTOM_BUCKET_PATH,
default_bucket=custom_default_bucket,
)


Expand Down Expand Up @@ -255,10 +262,10 @@ def test_sklearn_with_custom_default_bucket(
job_description = sklearn_processor.latest_job.describe()

assert job_description["ProcessingInputs"][0]["InputName"] == "dummy_input"
assert CUSTOM_BUCKET_PATH in job_description["ProcessingInputs"][0]["S3Input"]["S3Uri"]
assert CUSTOM_BUCKET_PATH_PREFIX in job_description["ProcessingInputs"][0]["S3Input"]["S3Uri"]

assert job_description["ProcessingInputs"][1]["InputName"] == "code"
assert CUSTOM_BUCKET_PATH in job_description["ProcessingInputs"][1]["S3Input"]["S3Uri"]
assert CUSTOM_BUCKET_PATH_PREFIX in job_description["ProcessingInputs"][1]["S3Input"]["S3Uri"]

assert job_description["ProcessingJobName"].startswith("test-sklearn-with-customizations")

Expand Down Expand Up @@ -564,7 +571,7 @@ def test_processor_with_custom_bucket(
job_description = processor.latest_job.describe()

assert job_description["ProcessingInputs"][0]["InputName"] == "code"
assert CUSTOM_BUCKET_PATH in job_description["ProcessingInputs"][0]["S3Input"]["S3Uri"]
assert CUSTOM_BUCKET_PATH_PREFIX in job_description["ProcessingInputs"][0]["S3Input"]["S3Uri"]

assert job_description["ProcessingJobName"].startswith("test-processor")

Expand Down