Throw exception if an update is attempted on a stack in ROLLBACK_COMPLETE
If a stack has a status of ROLLBACK_COMPLETE and you attempt to update it, the AWS API throws a validation error. This updates moto to have the same behvaior. We also uncommented a test which tests updating a stack which passed without any additional modification -- it is unclear why this test was commented. Signed-off-by: Jack Lund <jack.lund@getbraintree.com>
This commit is contained in:
parent
a600deb96a
commit
6928501973
3 changed files with 28 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ import tests.backport_assert_raises # noqa
|
|||
from nose.tools import assert_raises
|
||||
|
||||
from moto import mock_cloudformation, mock_s3
|
||||
from moto.cloudformation import cloudformation_backends
|
||||
|
||||
dummy_template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
|
@ -286,6 +287,7 @@ def test_update_stack():
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
def test_update_stack():
|
||||
conn = boto.connect_cloudformation()
|
||||
|
|
@ -307,3 +309,20 @@ def test_update_stack():
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
def test_update_stack_when_rolled_back():
|
||||
conn = boto.connect_cloudformation()
|
||||
stack_id = conn.create_stack("test_stack", template_body=dummy_template_json)
|
||||
|
||||
cloudformation_backends[conn.region.name].stacks[stack_id].status = 'ROLLBACK_COMPLETE'
|
||||
|
||||
with assert_raises(BotoServerError) as err:
|
||||
conn.update_stack("test_stack", dummy_template_json)
|
||||
|
||||
ex = err.exception
|
||||
ex.body.should.match(r'is in ROLLBACK_COMPLETE state and can not be updated')
|
||||
ex.error_code.should.equal('ValidationError')
|
||||
ex.reason.should.equal('Bad Request')
|
||||
ex.status.should.equal(400)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue