convection 0.2.32 → 0.2.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -1
  3. data/.rubocop_todo.yml +1 -2
  4. data/Gemfile +2 -1
  5. data/Rakefile +3 -7
  6. data/lib/convection.rb +2 -2
  7. data/lib/convection/control/stack.rb +49 -10
  8. data/lib/convection/model/event.rb +3 -2
  9. data/lib/convection/model/template.rb +13 -1
  10. data/lib/convection/model/template/metadata.rb +22 -0
  11. data/lib/convection/model/template/resource/aws_ec2_subnet.rb +1 -0
  12. data/lib/convection/model/template/resource/aws_events_rule.rb +4 -0
  13. data/spec/cf_client_context.rb +10 -0
  14. data/spec/collect_availability_zones_task_context.rb +17 -0
  15. data/spec/convection/control/stack/after_create_tasks_spec.rb +51 -0
  16. data/spec/convection/control/stack/after_delete_tasks_spec.rb +51 -0
  17. data/spec/convection/control/stack/after_update_tasks_spec.rb +54 -0
  18. data/spec/convection/control/stack/before_create_tasks_spec.rb +52 -0
  19. data/spec/convection/control/stack/before_delete_tasks_spec.rb +51 -0
  20. data/spec/convection/control/stack/before_update_tasks_spec.rb +55 -0
  21. data/spec/convection/dsl/intrinsic_functions_spec.rb +88 -0
  22. data/spec/convection/model/template/condition_spec.rb +38 -0
  23. data/spec/convection/model/template/resource/directoryservice_simple_ad_spec.rb +39 -0
  24. data/spec/convection/model/template/resource/ec2_security_group_spec.rb +39 -0
  25. data/spec/convection/model/template/resource/ec2_subnet_spec.rb +48 -0
  26. data/spec/convection/model/template/resource/elasticache_cache_cluster_spec.rb +52 -0
  27. data/spec/convection/model/template/resource/elasticache_parameter_group_spec.rb +38 -0
  28. data/spec/convection/model/template/resource/elasticache_security_group_ingress_spec.rb +40 -0
  29. data/spec/convection/model/template/resource/elasticache_security_group_spec.rb +32 -0
  30. data/spec/convection/model/template/resource/events_rule_spec.rb +44 -0
  31. data/spec/convection/model/template/resource/iam_role_spec.rb +37 -0
  32. data/spec/convection/model/template/resource/lambdas_spec.rb +70 -0
  33. data/spec/convection/model/template/resource/loggroups_spec.rb +34 -0
  34. data/spec/convection/model/template/resource/permission_spec.rb +43 -0
  35. data/spec/convection/model/template/resource/rds_security_groups_spec.rb +50 -0
  36. data/spec/convection/model/template/resource/vpc_endpoints_spec.rb +65 -0
  37. data/spec/convection/model/template/resource_attribute/update_policies_spec.rb +66 -0
  38. data/spec/convection/model/template/template_spec.rb +60 -0
  39. data/spec/convection/model/template/validate_bytesize_spec.rb +49 -0
  40. data/spec/convection/model/template/validate_description_spec.rb +31 -0
  41. data/spec/convection/model/template/validate_mappings_spec.rb +88 -0
  42. data/spec/convection/model/template/validate_outputs_spec.rb +62 -0
  43. data/spec/convection/model/template/validate_parameters_spec.rb +84 -0
  44. data/spec/convection/model/template/validate_resources_spec.rb +50 -0
  45. data/spec/ec2_client_context.rb +18 -0
  46. data/spec/spec_helper.rb +11 -0
  47. metadata +72 -40
  48. data/test/convection/model/test_conditions.rb +0 -121
  49. data/test/convection/model/test_directory_service.rb +0 -40
  50. data/test/convection/model/test_elasticache.rb +0 -97
  51. data/test/convection/model/test_lambdas.rb +0 -53
  52. data/test/convection/model/test_loggroups.rb +0 -25
  53. data/test/convection/model/test_permission.rb +0 -31
  54. data/test/convection/model/test_rds.rb +0 -76
  55. data/test/convection/model/test_template.rb +0 -64
  56. data/test/convection/model/test_trust.rb +0 -28
  57. data/test/convection/model/test_update_policies.rb +0 -54
  58. data/test/convection/model/test_validation.rb +0 -216
  59. data/test/convection/model/test_vpc_endpoint.rb +0 -51
  60. data/test/convection/tasks/test_after_create_tasks.rb +0 -66
  61. data/test/convection/tasks/test_after_delete_tasks.rb +0 -66
  62. data/test/convection/tasks/test_after_update_tasks.rb +0 -71
  63. data/test/convection/tasks/test_before_create_tasks.rb +0 -66
  64. data/test/convection/tasks/test_before_delete_tasks.rb +0 -66
  65. data/test/convection/tasks/test_before_update_tasks.rb +0 -71
  66. data/test/test_helper.rb +0 -72
@@ -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