Skip to content

Commit 62bc94d

Browse files
committed
Add unit test
1 parent 534270e commit 62bc94d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/unit/sagemaker/serverless/test_model.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ def test_deploy(mock_client, wait):
4747
assert predictor.function_name == function_name
4848

4949

50+
def test_deploy_raises_error_on_failure(mock_client):
51+
model = LambdaModel(IMAGE_URI, ROLE, client=mock_client)
52+
mock_client.create_function = Mock(return_value={"State": "Pending"})
53+
mock_client.get_function_configuration = Mock(return_value={"State": "Failed", "StateReason": "Resource limit"})
54+
55+
with pytest.raises(RuntimeError):
56+
model.deploy("my-function", timeout=3, memory_size=128, wait=True)
57+
58+
5059
def test_destroy():
5160
model = LambdaModel(IMAGE_URI, ROLE, client=mock_client)
5261
model.delete_model() # NOTE: This method is a no-op.

0 commit comments

Comments
 (0)