Disallow termination of protected EMR job flows (#4015)
Error message verified against real AWS backend.
This commit is contained in:
parent
67ae84e2c4
commit
b0e2a750dc
4 changed files with 39 additions and 5 deletions
|
|
@ -708,6 +708,25 @@ def test_set_termination_protection():
|
|||
resp["Cluster"]["TerminationProtected"].should.equal(expected)
|
||||
|
||||
|
||||
@mock_emr
|
||||
def test_terminate_protected_job_flow_raises_error():
|
||||
client = boto3.client("emr", region_name="us-east-1")
|
||||
resp = client.run_job_flow(**run_job_flow_args)
|
||||
cluster_id = resp["JobFlowId"]
|
||||
client.set_termination_protection(
|
||||
JobFlowIds=[cluster_id], TerminationProtected=True
|
||||
)
|
||||
with pytest.raises(ClientError) as ex:
|
||||
client.terminate_job_flows(
|
||||
JobFlowIds=[cluster_id,]
|
||||
)
|
||||
error = ex.value.response["Error"]
|
||||
error["Code"].should.equal("ValidationException")
|
||||
error["Message"].should.equal(
|
||||
"Could not shut down one or more job flows since they are termination protected."
|
||||
)
|
||||
|
||||
|
||||
@mock_emr
|
||||
def test_set_visible_to_all_users():
|
||||
client = boto3.client("emr", region_name="us-east-1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue