stack_master 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/stack_master/commands/terminal_helper.rb +14 -1
  4. data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
  5. data/lib/stack_master/version.rb +1 -1
  6. metadata +21 -216
  7. data/.gitignore +0 -18
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -12
  10. data/CODE_OF_CONDUCT.md +0 -73
  11. data/Gemfile +0 -4
  12. data/LICENSE.txt +0 -22
  13. data/Rakefile +0 -27
  14. data/apply_demo.gif +0 -0
  15. data/example/simple/Gemfile +0 -3
  16. data/example/simple/parameters/myapp_vpc.yml +0 -1
  17. data/example/simple/parameters/myapp_web.yml +0 -2
  18. data/example/simple/stack_master.yml +0 -13
  19. data/example/simple/templates/myapp_vpc.rb +0 -39
  20. data/example/simple/templates/myapp_web.rb +0 -16
  21. data/features/apply.feature +0 -392
  22. data/features/apply_with_compile_time_parameters.feature +0 -93
  23. data/features/apply_with_env_parameters.feature +0 -49
  24. data/features/apply_with_parameter_store_parameters.feature +0 -47
  25. data/features/apply_with_s3.feature +0 -106
  26. data/features/delete.feature +0 -29
  27. data/features/diff.feature +0 -179
  28. data/features/events.feature +0 -33
  29. data/features/init.feature +0 -6
  30. data/features/outputs.feature +0 -45
  31. data/features/region_aliases.feature +0 -62
  32. data/features/resources.feature +0 -42
  33. data/features/stack_defaults.feature +0 -82
  34. data/features/status.feature +0 -118
  35. data/features/step_definitions/parameter_store_steps.rb +0 -14
  36. data/features/step_definitions/stack_steps.rb +0 -71
  37. data/features/support/env.rb +0 -16
  38. data/features/validate.feature +0 -46
  39. data/logo.png +0 -0
  40. data/script/buildkite/bundle.sh +0 -5
  41. data/script/buildkite/clean.sh +0 -3
  42. data/script/buildkite_rspec.sh +0 -27
  43. data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
  44. data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
  45. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
  46. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
  47. data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
  48. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
  49. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
  50. data/spec/fixtures/stack_master.yml +0 -49
  51. data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
  52. data/spec/fixtures/templates/myapp_vpc.json +0 -1
  53. data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
  54. data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
  55. data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
  56. data/spec/fixtures/test/.gitkeep +0 -0
  57. data/spec/spec_helper.rb +0 -102
  58. data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
  59. data/spec/stack_master/change_set_spec.rb +0 -70
  60. data/spec/stack_master/command_spec.rb +0 -66
  61. data/spec/stack_master/commands/apply_spec.rb +0 -259
  62. data/spec/stack_master/commands/delete_spec.rb +0 -40
  63. data/spec/stack_master/commands/init_spec.rb +0 -17
  64. data/spec/stack_master/commands/status_spec.rb +0 -44
  65. data/spec/stack_master/commands/validate_spec.rb +0 -27
  66. data/spec/stack_master/config_spec.rb +0 -153
  67. data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
  68. data/spec/stack_master/parameter_loader_spec.rb +0 -110
  69. data/spec/stack_master/parameter_resolver_spec.rb +0 -148
  70. data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
  71. data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
  72. data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
  73. data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
  74. data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
  75. data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
  76. data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
  77. data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
  78. data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
  79. data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
  80. data/spec/stack_master/prompter_spec.rb +0 -23
  81. data/spec/stack_master/resolver_array_spec.rb +0 -42
  82. data/spec/stack_master/security_group_finder_spec.rb +0 -49
  83. data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
  84. data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
  85. data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
  86. data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
  87. data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
  88. data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
  89. data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
  90. data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
  91. data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
  92. data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
  93. data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
  94. data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
  95. data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
  96. data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
  97. data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
  98. data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
  99. data/spec/stack_master/stack_definition_spec.rb +0 -70
  100. data/spec/stack_master/stack_differ_spec.rb +0 -46
  101. data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
  102. data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
  103. data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
  104. data/spec/stack_master/stack_spec.rb +0 -184
  105. data/spec/stack_master/template_compiler_spec.rb +0 -39
  106. data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
  107. data/spec/stack_master/template_compilers/json_spec.rb +0 -32
  108. data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
  109. data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
  110. data/spec/stack_master/template_utils_spec.rb +0 -21
  111. data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
  112. data/spec/stack_master/test_driver/s3_spec.rb +0 -17
  113. data/spec/stack_master/utils_spec.rb +0 -30
  114. data/spec/stack_master/validator_spec.rb +0 -56
  115. data/spec/stack_master_spec.rb +0 -81
  116. data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
  117. data/spec/support/validator_spec.rb +0 -23
  118. data/stack_master.gemspec +0 -46
  119. data/stacktemplates/parameter_region.yml +0 -3
  120. data/stacktemplates/parameter_stack_name.yml +0 -3
  121. data/stacktemplates/stack.json.erb +0 -20
  122. data/stacktemplates/stack_master.yml.erb +0 -6
@@ -1,33 +0,0 @@
1
- Feature: Events command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- myapp_vpc:
9
- template: myapp_vpc.rb
10
- """
11
- And a directory named "templates"
12
- And a file named "templates/myapp_vpc.rb" with:
13
- """
14
- SparkleFormation.new(:myapp_vpc) do
15
- description "Test template"
16
- set!('AWSTemplateFormatVersion', '2010-09-09')
17
-
18
- resources.vpc do
19
- type 'AWS::EC2::VPC'
20
- properties do
21
- cidr_block '10.200.0.0/16'
22
- end
23
- end
24
- end
25
- """
26
-
27
- Scenario: View events
28
- Given I stub the following stack events:
29
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
30
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
31
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
32
- When I run `stack_master events us-east-1 myapp-vpc --trace`
33
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
@@ -1,6 +0,0 @@
1
- Feature: init project
2
-
3
- Scenario: Run init
4
- When I run `stack_master init us-east-1 my-app`
5
- # TODO flesh this out
6
- Then the exit status should be 0
@@ -1,45 +0,0 @@
1
- Feature: Outputs command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- myapp_vpc:
9
- template: myapp_vpc.rb
10
- """
11
- And a directory named "templates"
12
- And a file named "templates/myapp_vpc.rb" with:
13
- """
14
- SparkleFormation.new(:myapp_vpc) do
15
- description "Test template"
16
- set!('AWSTemplateFormatVersion', '2010-09-09')
17
- resources.vpc do
18
- type 'AWS::EC2::VPC'
19
- properties do
20
- cidr_block '10.200.0.0/16'
21
- end
22
- end
23
- end
24
- """
25
-
26
- Scenario: Output stack resources
27
- Given I stub the following stacks:
28
- | stack_id | stack_name | parameters | region | outputs |
29
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 | VpcId=vpc-123456 |
30
- And I stub a template for the stack "myapp-vpc":
31
- """
32
- {
33
- }
34
- """
35
- When I run `stack_master outputs us-east-1 myapp-vpc --trace`
36
- And the output should contain all of these lines:
37
- | VpcId |
38
- | vpc-123456 |
39
-
40
- Scenario: Fails when the stack doesn't exist
41
- When I run `stack_master outputs us-east-1 myapp-vpc --trace`
42
- And the output should not contain all of these lines:
43
- | VpcId |
44
- | vpc-123456 |
45
- And the output should contain "Stack doesn't exist"
@@ -1,62 +0,0 @@
1
- Feature: Region aliases
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- region_aliases:
7
- staging: ap-southeast-2
8
- production: us_east_1
9
- stacks:
10
- staging:
11
- myapp_vpc:
12
- template: myapp_vpc.rb
13
- production:
14
- myapp_vpc:
15
- template: myapp_vpc.rb
16
- """
17
- And a directory named "templates"
18
- And a directory named "parameters"
19
- And a file named "templates/myapp_vpc.rb" with:
20
- """
21
- SparkleFormation.new(:myapp_vpc) do
22
- description "Test template"
23
- set!('AWSTemplateFormatVersion', '2010-09-09')
24
-
25
- parameters.key_name do
26
- description 'Key name'
27
- type 'String'
28
- end
29
-
30
- resources.vpc do
31
- type 'AWS::EC2::VPC'
32
- properties do
33
- cidr_block '10.200.0.0/16'
34
- end
35
- end
36
-
37
- outputs do
38
- vpc_id do
39
- description 'A VPC ID'
40
- value ref!(:vpc)
41
- end
42
- end
43
- end
44
- """
45
- And a file named "parameters/myapp_vpc.yml" with:
46
- """
47
- key_name: my-key
48
- """
49
- And I stub the following stack events:
50
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
51
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
52
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
53
-
54
- Scenario: Create a stack using region aliases
55
- When I run `stack_master apply staging myapp-vpc --trace`
56
- And the output should contain all of these lines:
57
- | Stack diff: |
58
- | + "Vpc": { |
59
- | Parameters diff: |
60
- | KeyName: my-key |
61
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
62
- Then the exit status should be 0
@@ -1,42 +0,0 @@
1
- Feature: Resources command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- myapp_vpc:
9
- template: myapp_vpc.rb
10
- """
11
- And a directory named "templates"
12
- And a file named "templates/myapp_vpc.rb" with:
13
- """
14
- SparkleFormation.new(:myapp_vpc) do
15
- description "Test template"
16
- set!('AWSTemplateFormatVersion', '2010-09-09')
17
- resources.vpc do
18
- type 'AWS::EC2::VPC'
19
- properties do
20
- cidr_block '10.200.0.0/16'
21
- end
22
- end
23
- end
24
- """
25
-
26
- Scenario: Show resources
27
- Given I stub the following stacks:
28
- | stack_id | stack_name | parameters | region |
29
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 |
30
- And I stub the following stack resources:
31
- | stack_name | logical_resource_id | resource_type | timestamp | resource_status |
32
- | myapp-vpc | Vpc | AWS::EC2::Vpc | 2015-11-02 06:41:58 | CREATE_COMPLETE |
33
- When I run `stack_master resources us-east-1 myapp-vpc --trace`
34
- And the output should contain all of these lines:
35
- | Vpc |
36
- | AWS::EC2::Vpc |
37
- | 2015-11-02 06:41:58 |
38
- | CREATE_COMPLETE |
39
-
40
- Scenario: Fails when the stack doesn't exist
41
- When I run `stack_master resources us-east-1 myapp-vpc --trace`
42
- And the output should contain "Stack doesn't exist"
@@ -1,82 +0,0 @@
1
- Feature: Stack defaults
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stack_defaults:
7
- tags:
8
- application: my-awesome-blog
9
- region_defaults:
10
- ap_southeast_2:
11
- notification_arns:
12
- - test_arn_1
13
- secret_file: staging.yml.gpg
14
- tags:
15
- environment: staging
16
- stack_policy_file: my_policy.json
17
- us_east_1:
18
- notification_arns:
19
- - test_arn_2
20
- secret_file: production.yml.gpg
21
- tags:
22
- environment: production
23
- stacks:
24
- ap_southeast_2:
25
- myapp_vpc:
26
- template: myapp_vpc.rb
27
- tags:
28
- role: network
29
- notification_arns:
30
- - test_arn_3
31
- us_east_1:
32
- myapp_vpc:
33
- template: myapp_vpc.rb
34
- tags:
35
- role: network
36
- """
37
- And a directory named "templates"
38
- And a directory named "policies"
39
- And a file named "templates/myapp_vpc.rb" with:
40
- """
41
- SparkleFormation.new(:myapp_vpc) do
42
- description "Test template"
43
- set!('AWSTemplateFormatVersion', '2010-09-09')
44
-
45
- parameters.key_name do
46
- description 'Key name'
47
- type 'String'
48
- default 'blah'
49
- end
50
-
51
- resources.vpc do
52
- type 'AWS::EC2::VPC'
53
- properties do
54
- cidr_block '10.200.0.0/16'
55
- end
56
- end
57
-
58
- outputs do
59
- vpc_id do
60
- description 'A VPC ID'
61
- value ref!(:vpc)
62
- end
63
- end
64
- end
65
- """
66
- And a file named "policies/my_policy.json" with:
67
- """
68
- {my: 'policy'}
69
- """
70
- And I stub the following stack events:
71
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
72
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
73
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
74
-
75
- Scenario: Create a stack with inherited attributes
76
- When I run `stack_master apply ap-southeast-2 myapp-vpc --trace`
77
- Then the stack "myapp-vpc" should contain this notification ARN "test_arn_1"
78
- Then the stack "myapp-vpc" should contain this notification ARN "test_arn_3"
79
- And the stack "myapp-vpc" should have a policy with the following:
80
- """
81
- {my: 'policy'}
82
- """
@@ -1,118 +0,0 @@
1
- Feature: Status command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- stack1:
9
- template: stack1.json
10
- stack2:
11
- template: stack2.json
12
- stack3:
13
- template: stack3.json
14
- """
15
- And a directory named "parameters"
16
- And a file named "parameters/stack1.yml" with:
17
- """
18
- KeyName: my-key
19
- """
20
- And a directory named "templates"
21
- And a file named "templates/stack1.json" with:
22
- """
23
- {
24
- "AWSTemplateFormatVersion": "2010-09-09",
25
- "Description": "Test template",
26
- "Parameters": {
27
- "InstanceTypeParameter" : { "Type" : "String" }
28
- },
29
- "Mappings": {},
30
- "Resources": {
31
- "MyAwesomeQueue" : {
32
- "Type" : "AWS::SQS::Queue",
33
- "Properties" : {
34
- "VisibilityTimeout" : "1"
35
- }
36
- }
37
- },
38
- "Outputs": {}
39
- }
40
- """
41
- And a file named "templates/stack2.json" with:
42
- """
43
- {
44
- "AWSTemplateFormatVersion": "2010-09-09",
45
- "Description": "Test template",
46
- "Parameters": {},
47
- "Mappings": {},
48
- "Resources": {
49
- "MoarQueue" : {
50
- "Type" : "AWS::SQS::Queue",
51
- "Properties" : {
52
- "VisibilityTimeout" : "1"
53
- }
54
- }
55
- },
56
- "Outputs": {}
57
- }
58
- """
59
- And a file named "templates/stack3.json" with:
60
- """
61
- {
62
- }
63
- """
64
-
65
- Scenario: Run status command and get a list of stack statuii
66
- Given I stub the following stacks:
67
- | stack_id | stack_name | parameters | region | stack_status |
68
- | 1 | stack1 | KeyName=my-key | us-east-1 | CREATE_COMPLETE |
69
- | 2 | stack2 | | us-east-1 | UPDATE_COMPLETE |
70
- And I stub a template for the stack "stack1":
71
- """
72
- {
73
- "AWSTemplateFormatVersion": "2010-09-09",
74
- "Description": "Test template",
75
- "Parameters": {
76
- "InstanceTypeParameter" : { "Type" : "String" }
77
- },
78
- "Mappings": {},
79
- "Resources": {
80
- "MyAwesomeQueue" : {
81
- "Type" : "AWS::SQS::Queue",
82
- "Properties" : {
83
- "VisibilityTimeout" : "7"
84
- }
85
- }
86
- },
87
- "Outputs": {}
88
- }
89
- """
90
- And I stub a template for the stack "stack2":
91
- """
92
- {
93
- "AWSTemplateFormatVersion": "2010-09-09",
94
- "Description": "Test template",
95
- "Parameters": {},
96
- "Mappings": {},
97
- "Resources": {
98
- "MoarQueue" : {
99
- "Type" : "AWS::SQS::Queue",
100
- "Properties" : {
101
- "VisibilityTimeout" : "1"
102
- }
103
- }
104
- },
105
- "Outputs": {}
106
- }
107
- """
108
-
109
- When I run `stack_master status --trace`
110
- And the output should contain all of these lines:
111
- | REGION \| STACK_NAME \| STACK_STATUS \| DIFFERENT |
112
- | ----------\|------------\|-----------------\|---------- |
113
- | us-east-1 \| stack1 \| CREATE_COMPLETE \| Yes |
114
- | us-east-1 \| stack2 \| UPDATE_COMPLETE \| No |
115
- | us-east-1 \| stack3 \| \| Yes |
116
-
117
- Then the exit status should be 0
118
-
@@ -1,14 +0,0 @@
1
- Given(/^(?:a|the) SSM parameter(?: named)? "([^"]*)" with value "([^"]*)" in region "([^"]*)"$/) do |parameter_name, parameter_value, parameter_region|
2
- Aws.config[:ssm] = {
3
- stub_responses: {
4
- get_parameter: {
5
- parameter: {
6
- name: parameter_name,
7
- value: parameter_value,
8
- type: "SecureString",
9
- version: 1
10
- }
11
- }
12
- }
13
- }
14
- end
@@ -1,71 +0,0 @@
1
- Before do
2
- StackMaster.non_interactive_answer = 'y'
3
- end
4
-
5
- Given(/^I will answer prompts with "([^"]*)"$/) do |answer|
6
- StackMaster.non_interactive_answer = answer
7
- end
8
-
9
- Given(/^I stub the following stack events:$/) do |table|
10
- table.hashes.each do |row|
11
- row.symbolize_keys!
12
- StackMaster.cloud_formation_driver.add_stack_event(row)
13
- end
14
- end
15
-
16
- Given(/^I stub the following stack resources:$/) do |table|
17
- table.hashes.each do |row|
18
- row.symbolize_keys!
19
- StackMaster.cloud_formation_driver.add_stack_resource(row)
20
- end
21
- end
22
-
23
- def extract_hash_from_kv_string(string)
24
- string.to_s.split(',').inject({}) do |hash, kv|
25
- key, value = kv.split('=')
26
- hash[key] = value
27
- hash
28
- end
29
- end
30
-
31
-
32
- Given(/^I stub the following stacks:$/) do |table|
33
- table.hashes.each do |row|
34
- row.symbolize_keys!
35
- row[:parameters] = StackMaster::Utils.hash_to_aws_parameters(extract_hash_from_kv_string(row[:parameters]))
36
- outputs = extract_hash_from_kv_string(row[:outputs]).inject([]) do |array, (k, v)|
37
- array << OpenStruct.new(output_key: k, output_value: v)
38
- array
39
- end
40
- row[:outputs] = outputs
41
- StackMaster.cloud_formation_driver.add_stack(row)
42
- end
43
- end
44
-
45
- Given(/^I stub a template for the stack "([^"]*)":$/) do |stack_name, template_body|
46
- StackMaster.cloud_formation_driver.set_template(stack_name, template_body)
47
- end
48
-
49
- Then(/^the stack "([^"]*)" should have a policy with the following:$/) do |stack_name, policy|
50
- stack_policy_body = StackMaster.cloud_formation_driver.get_stack_policy(stack_name: stack_name).stack_policy_body
51
- expect(stack_policy_body).to eq policy
52
- end
53
-
54
- Then(/^the stack "([^"]*)" should contain this notification ARN "([^"]*)"$/) do |stack_name, notification_arn|
55
- stack = StackMaster.cloud_formation_driver.describe_stacks(stack_name: stack_name).stacks.first
56
- expect(stack).to be
57
- expect(stack.notification_arns).to include notification_arn
58
- end
59
-
60
- Given(/^I stub CloudFormation validate calls to pass validation$/) do
61
- allow(StackMaster.cloud_formation_driver).to receive(:validate_template).and_return(true)
62
- end
63
-
64
- Given(/^I stub CloudFormation validate calls to fail validation with message "([^"]*)"$/) do |message|
65
- allow(StackMaster.cloud_formation_driver).to receive(:validate_template).and_raise(Aws::CloudFormation::Errors::ValidationError.new('', message))
66
- end
67
-
68
- When(/^an S3 file in bucket "([^"]*)" with key "([^"]*)" exists with content:$/) do |bucket, key, body|
69
- file = StackMaster.s3_driver.find_file(bucket: bucket, object_key: key)
70
- expect(file).to eq body
71
- end