Skip to content

Commit 5f1131c

Browse files
committed
Update test_serverless.py
1 parent bc5a586 commit 5f1131c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/integ/test_serverless.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,18 @@
2020
from sagemaker.utils import unique_name_from_base
2121

2222
# See tests/data/serverless for the image source code.
23-
IMAGE_URI = "142577830533.dkr.ecr.us-west-2.amazonaws.com/serverless-integ-test:latest"
24-
ROLE = "arn:aws:iam::142577830533:role/lambda_basic_execution"
25-
URL = "https://c.files.bbci.co.uk/12A9B/production/_111434467_gettyimages-1143489763.jpg"
23+
ACCOUNT_ID = 142577830533
24+
IMAGE_URI = f"{ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/serverless-integ-test:latest"
25+
ROLE = f"arn:aws:iam::{ACCOUNT_ID}:role/lambda_basic_execution"
26+
URL = "https://sagemaker-integ-tests-data.s3.us-east-1.amazonaws.com/cat.jpeg"
2627

27-
print('"CODEBUILD_BUILD_ID" in os.environ =', "CODEBUILD_BUILD_ID" in os.environ)
2828

29-
30-
@pytest.mark.skipif(
31-
"CODEBUILD_BUILD_ID" not in os.environ,
32-
reason="The container image is private to the CI account.",
33-
)
3429
def test_lambda():
35-
model = LambdaModel(image_uri=IMAGE_URI, role=ROLE)
30+
client = boto3.client("lambda")
31+
if client.get_caller_identity().get("Account") != ACCOUNT_ID:
32+
pytest.skip("The container image is private to the CI account.")
33+
34+
model = LambdaModel(image_uri=IMAGE_URI, role=ROLE, client=client)
3635

3736
predictor = model.deploy(
3837
unique_name_from_base("my-lambda-function"), timeout=60, memory_size=4092

0 commit comments

Comments
 (0)