convection 0.2.32 → 0.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +1 -2
- data/Gemfile +2 -1
- data/Rakefile +3 -7
- data/lib/convection.rb +2 -2
- data/lib/convection/control/stack.rb +49 -10
- data/lib/convection/model/event.rb +3 -2
- data/lib/convection/model/template.rb +13 -1
- data/lib/convection/model/template/metadata.rb +22 -0
- data/lib/convection/model/template/resource/aws_ec2_subnet.rb +1 -0
- data/lib/convection/model/template/resource/aws_events_rule.rb +4 -0
- data/spec/cf_client_context.rb +10 -0
- data/spec/collect_availability_zones_task_context.rb +17 -0
- data/spec/convection/control/stack/after_create_tasks_spec.rb +51 -0
- data/spec/convection/control/stack/after_delete_tasks_spec.rb +51 -0
- data/spec/convection/control/stack/after_update_tasks_spec.rb +54 -0
- data/spec/convection/control/stack/before_create_tasks_spec.rb +52 -0
- data/spec/convection/control/stack/before_delete_tasks_spec.rb +51 -0
- data/spec/convection/control/stack/before_update_tasks_spec.rb +55 -0
- data/spec/convection/dsl/intrinsic_functions_spec.rb +88 -0
- data/spec/convection/model/template/condition_spec.rb +38 -0
- data/spec/convection/model/template/resource/directoryservice_simple_ad_spec.rb +39 -0
- data/spec/convection/model/template/resource/ec2_security_group_spec.rb +39 -0
- data/spec/convection/model/template/resource/ec2_subnet_spec.rb +48 -0
- data/spec/convection/model/template/resource/elasticache_cache_cluster_spec.rb +52 -0
- data/spec/convection/model/template/resource/elasticache_parameter_group_spec.rb +38 -0
- data/spec/convection/model/template/resource/elasticache_security_group_ingress_spec.rb +40 -0
- data/spec/convection/model/template/resource/elasticache_security_group_spec.rb +32 -0
- data/spec/convection/model/template/resource/events_rule_spec.rb +44 -0
- data/spec/convection/model/template/resource/iam_role_spec.rb +37 -0
- data/spec/convection/model/template/resource/lambdas_spec.rb +70 -0
- data/spec/convection/model/template/resource/loggroups_spec.rb +34 -0
- data/spec/convection/model/template/resource/permission_spec.rb +43 -0
- data/spec/convection/model/template/resource/rds_security_groups_spec.rb +50 -0
- data/spec/convection/model/template/resource/vpc_endpoints_spec.rb +65 -0
- data/spec/convection/model/template/resource_attribute/update_policies_spec.rb +66 -0
- data/spec/convection/model/template/template_spec.rb +60 -0
- data/spec/convection/model/template/validate_bytesize_spec.rb +49 -0
- data/spec/convection/model/template/validate_description_spec.rb +31 -0
- data/spec/convection/model/template/validate_mappings_spec.rb +88 -0
- data/spec/convection/model/template/validate_outputs_spec.rb +62 -0
- data/spec/convection/model/template/validate_parameters_spec.rb +84 -0
- data/spec/convection/model/template/validate_resources_spec.rb +50 -0
- data/spec/ec2_client_context.rb +18 -0
- data/spec/spec_helper.rb +11 -0
- metadata +72 -40
- data/test/convection/model/test_conditions.rb +0 -121
- data/test/convection/model/test_directory_service.rb +0 -40
- data/test/convection/model/test_elasticache.rb +0 -97
- data/test/convection/model/test_lambdas.rb +0 -53
- data/test/convection/model/test_loggroups.rb +0 -25
- data/test/convection/model/test_permission.rb +0 -31
- data/test/convection/model/test_rds.rb +0 -76
- data/test/convection/model/test_template.rb +0 -64
- data/test/convection/model/test_trust.rb +0 -28
- data/test/convection/model/test_update_policies.rb +0 -54
- data/test/convection/model/test_validation.rb +0 -216
- data/test/convection/model/test_vpc_endpoint.rb +0 -51
- data/test/convection/tasks/test_after_create_tasks.rb +0 -66
- data/test/convection/tasks/test_after_delete_tasks.rb +0 -66
- data/test/convection/tasks/test_after_update_tasks.rb +0 -71
- data/test/convection/tasks/test_before_create_tasks.rb +0 -66
- data/test/convection/tasks/test_before_delete_tasks.rb +0 -66
- data/test/convection/tasks/test_before_update_tasks.rb +0 -71
- data/test/test_helper.rb +0 -72
data/test/test_helper.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start do
|
3
|
-
add_group 'Control', 'lib/convection/control'
|
4
|
-
add_group 'Model', 'lib/convection/model'
|
5
|
-
add_group 'DSL', 'lib/convection/dsl'
|
6
|
-
end
|
7
|
-
|
8
|
-
gem 'minitest'
|
9
|
-
require 'minitest/autorun'
|
10
|
-
require 'minitest/spec'
|
11
|
-
require_relative '../lib/convection'
|
12
|
-
|
13
|
-
module Minitest::Assertions
|
14
|
-
def assert_nothing_raised(*)
|
15
|
-
yield
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module TestHelper
|
20
|
-
class CollectAvailabilityZonesTask
|
21
|
-
attr_writer :availability_zones
|
22
|
-
|
23
|
-
def availability_zones
|
24
|
-
@availability_zones ||= []
|
25
|
-
end
|
26
|
-
|
27
|
-
def call(stack)
|
28
|
-
self.availability_zones += stack.availability_zones
|
29
|
-
end
|
30
|
-
|
31
|
-
def success?
|
32
|
-
availability_zones.any?
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def mock_cloudformation_client
|
39
|
-
cf_client = Minitest::Mock.new
|
40
|
-
any_args = [->(*) { true }]
|
41
|
-
cf_client.expect(:create_stack, nil, any_args)
|
42
|
-
cf_client.expect(:delete_stack, nil, any_args)
|
43
|
-
cf_client.expect(:describe_stacks, nil)
|
44
|
-
cf_client.expect(:update_stack, nil, any_args)
|
45
|
-
def cf_client.describe_stacks(*)
|
46
|
-
context = nil # we don't need any request context here.
|
47
|
-
raise Aws::CloudFormation::Errors::ValidationError.new(context, 'Stack does not exist.')
|
48
|
-
end
|
49
|
-
|
50
|
-
cf_client
|
51
|
-
end
|
52
|
-
|
53
|
-
def mock_ec2_client
|
54
|
-
zones = %w(eu-central-1 eu-west-1).map do |zone|
|
55
|
-
mock = Minitest::Mock.new
|
56
|
-
mock.expect(:zone_name, zone)
|
57
|
-
end
|
58
|
-
availability_zone_description = Minitest::Mock.new
|
59
|
-
availability_zone_description.expect(:availability_zones, zones)
|
60
|
-
|
61
|
-
ec2_client = Minitest::Mock.new
|
62
|
-
ec2_client.expect(:describe_availability_zones, availability_zone_description)
|
63
|
-
ec2_client
|
64
|
-
end
|
65
|
-
|
66
|
-
# Stub both exist/exist? since aliases are not overridden when stubbing in minitest.
|
67
|
-
def stub_existence(stack, exists, &block)
|
68
|
-
stack.stub(:exist, exists) do
|
69
|
-
stack.stub(:exist?, exists, &block)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|