summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDennis Benkert <spinecrasher@googlemail.com>2018-06-25 18:39:32 +0200
committerRyan Brown <sb@ryansb.com>2018-06-25 18:39:32 +0200
commit28d0a173dbb5a912e5c3f7f17ac0677677958d5b (patch)
treecdc6ada4a8392f0e156ad9f4c664083e31b36b72 /test
parentVMware: add new parameter in networks (#41899) (diff)
downloadansible-28d0a173dbb5a912e5c3f7f17ac0677677958d5b.tar.xz
ansible-28d0a173dbb5a912e5c3f7f17ac0677677958d5b.zip
[aws] add limit on number of CloudFormation stack events fetched by cloudformation module (#41840)
* Add a module parameter to configure the max fetched AWS CFN stack events * Add version documentation for new configuration option * Increase default in order to make sure that enough are fetched by default. This align roughly with the limit of manageable resources in CloudFormation.
Diffstat (limited to 'test')
-rw-r--r--test/units/modules/cloud/amazon/test_cloudformation.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/units/modules/cloud/amazon/test_cloudformation.py b/test/units/modules/cloud/amazon/test_cloudformation.py
index 9ba0ca9aeb..511c136ef3 100644
--- a/test/units/modules/cloud/amazon/test_cloudformation.py
+++ b/test/units/modules/cloud/amazon/test_cloudformation.py
@@ -44,6 +44,8 @@ bad_json_tpl = """{
}
}"""
+default_events_limit = 10
+
class FakeModule(object):
def __init__(self, **kwargs):
@@ -68,7 +70,7 @@ def test_invalid_template_json(placeboify):
}
m = FakeModule(disable_rollback=False)
with pytest.raises(Exception, message='Malformed JSON should cause the test to fail') as exc_info:
- cfn_module.create_stack(m, params, connection)
+ cfn_module.create_stack(m, params, connection, default_events_limit)
assert exc_info.match('FAIL')
assert "ValidationError" in m.exit_kwargs['msg']
@@ -81,7 +83,7 @@ def test_client_request_token_s3_stack(maybe_sleep, placeboify):
'ClientRequestToken': '3faf3fb5-b289-41fc-b940-44151828f6cf',
}
m = FakeModule(disable_rollback=False)
- result = cfn_module.create_stack(m, params, connection)
+ result = cfn_module.create_stack(m, params, connection, default_events_limit)
assert result['changed']
assert len(result['events']) > 1
# require that the final recorded stack state was CREATE_COMPLETE
@@ -97,7 +99,7 @@ def test_basic_s3_stack(maybe_sleep, placeboify):
'TemplateBody': basic_yaml_tpl
}
m = FakeModule(disable_rollback=False)
- result = cfn_module.create_stack(m, params, connection)
+ result = cfn_module.create_stack(m, params, connection, default_events_limit)
assert result['changed']
assert len(result['events']) > 1
# require that the final recorded stack state was CREATE_COMPLETE
@@ -108,7 +110,7 @@ def test_basic_s3_stack(maybe_sleep, placeboify):
def test_delete_nonexistent_stack(maybe_sleep, placeboify):
connection = placeboify.client('cloudformation')
- result = cfn_module.stack_operation(connection, 'ansible-test-nonexist', 'DELETE')
+ result = cfn_module.stack_operation(connection, 'ansible-test-nonexist', 'DELETE', default_events_limit)
assert result['changed']
assert 'Stack does not exist.' in result['log']
@@ -124,7 +126,8 @@ def test_missing_template_body(placeboify):
cfn_module.create_stack(
module=m,
stack_params={},
- cfn=None
+ cfn=None,
+ events_limit=default_events_limit
)
assert exc_info.match('FAIL')
assert not m.exit_args