cloudformation_rspec 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 9e741127a74f674f19e97e2d5c25dedfb96cab8eb471fe65a4ba8ba5d5e18fd4
4
- data.tar.gz: 84004c6abe9054bdd0eccaf8a81996916976c29b45794fb591ef5ba098ffdbe2
2
+ SHA1:
3
+ metadata.gz: 3db66fc637f051d0215b0a032ec4c4b8c53a79b8
4
+ data.tar.gz: 9c8369901d78964f71cab1d6663395162883d9ce
5
5
  SHA512:
6
- metadata.gz: 7b0df6dabb6d58df4bc7bbbdfc70d9ced98dea284522ffc30eabf5fe31f8e15a0f39ba42ed18b293f1944af44a385e5b056370b367f5c4181c5f669b1f79e7a7
7
- data.tar.gz: 98b37a583ed876cbd4fcf60ede9f642e7202010ea61ff23936ca319791bacefb70efb6000647d2c4ea2309e0158c3cfd4d0d3bc34365ab9ef7ca7ceba6633d61
6
+ metadata.gz: 6345dfdd804ccfa4624e262671e329a88ef21a99db8e35ede647c69477f56e7ddfa5339c3ef9003edcb11d83951077f5c2f95e9c2de55ba255b62165da12ec53
7
+ data.tar.gz: a97a4ddd76b905580867fdbdd2c54d48b5560a83bd06f3d6ce2e06ab9e54eac0dacf318eef66e67a687ac7659aaf57b4de6bed494dab05ae4ceb0bffaa0cc842
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.7
4
+ - 2.4.4
5
+ - 2.5.1
6
+ script: bundle exec rake spec
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at patrick.robinson@envato.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Envato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -11,12 +11,12 @@ CloudFormation RSpec enables us to use RSpec matchers test your templates agains
11
11
  ```ruby
12
12
  describe 'vpc_template' do
13
13
  let(:template_json) { File.read('fixtures/vpc.json') }
14
- let(:stack) {
14
+ let(:stack) {{
15
15
  template_body: template_json,
16
16
  parameters: {
17
17
  "VpcCidr" => cidr,
18
18
  }
19
- }
19
+ }}
20
20
 
21
21
  it 'is valid' do
22
22
  expect(template_json).to be_valid
@@ -75,6 +75,25 @@ describe 'vpc_template' do
75
75
  end
76
76
  ```
77
77
 
78
+ ## Development Status
79
+
80
+ In production use
81
+
82
+ ## Maintainers
83
+
84
+ Patrick Robinson (@patrobinson)
85
+
78
86
  ## Limitations
79
87
 
80
88
  Currently we don't support templates larger than 51,200 bytes, as this requires uploading the template to S3 first.
89
+
90
+ ## Contributing
91
+
92
+ For bug fixes, documentation changes, and small features:
93
+ 1. Fork it ( https://github.com/envato/cloudformation_rspec/fork )
94
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
95
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
96
+ 4. Push to the branch (`git push origin my-new-feature`)
97
+ 5. Create a new Pull Request
98
+
99
+ For larger new features: Do everything as above, but first also make contact with the project maintainers to be sure your change fits with the project direction and you won't be wasting effort going in the wrong direction
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require "bundler/gem_tasks"
1
2
  require 'rspec/core/rake_task'
2
3
 
3
4
  RSpec::Core::RakeTask.new
@@ -2,7 +2,7 @@ $:.unshift File.expand_path("../lib", __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "cloudformation_rspec"
5
- gem.version = "0.0.9"
5
+ gem.version = "0.1.0"
6
6
 
7
7
  gem.authors = ["Patrick Robinson"]
8
8
  gem.email = ["patrick.robinson@envato.com"]
@@ -15,7 +15,7 @@ class CloudFormationRSpec::ChangeSet
15
15
 
16
16
  @change_set_cache = {}
17
17
 
18
- attr_reader :changes, :status
18
+ attr_reader :changes, :status, :status_reason
19
19
 
20
20
  def initialize(template_body:, parameters: {})
21
21
  @template_body = template_body
@@ -38,6 +38,7 @@ class CloudFormationRSpec::ChangeSet
38
38
  if change_set = self.class.get_from_cache(change_set_hash)
39
39
  @status = change_set.status
40
40
  @changes = change_set.changes.map { |change| CloudFormationRSpec::ResourceChange.new(change.resource_change.resource_type, change.resource_change.logical_resource_id) }
41
+ @status_reason = change_set.status_reason
41
42
  return change_set
42
43
  end
43
44
 
@@ -58,6 +59,7 @@ class CloudFormationRSpec::ChangeSet
58
59
  end
59
60
  @status = response.status
60
61
  @changes = response.changes.map { |change| CloudFormationRSpec::ResourceChange.new(change.resource_change.resource_type, change.resource_change.logical_resource_id) }
62
+ @status_reason = response.status_reason
61
63
  client.delete_change_set(change_set_name: change_set_name, stack_name: change_set_name)
62
64
  client.delete_stack(stack_name: change_set_name) if stack_created
63
65
  self.class.add_to_cache(change_set_hash, response)
@@ -22,6 +22,7 @@ describe CloudFormationRSpec::ChangeSet do
22
22
  allow(cf_stub).to receive(:describe_stacks).and_return(stacks_mock)
23
23
  allow(cf_stub).to receive(:wait_until).and_return(true)
24
24
  allow(change_set_mock).to receive(:status).and_return("CREATE_COMPLETE")
25
+ allow(change_set_mock).to receive(:status_reason).and_return("Success")
25
26
  allow(change_set_mock).to receive(:changes).and_return([aws_change_mock])
26
27
  allow(aws_change_mock).to receive(:resource_change).and_return(aws_resource_change_mock)
27
28
  allow(stacks_mock).to receive(:stacks).and_return([stack_mock])
@@ -131,6 +132,7 @@ describe CloudFormationRSpec::ChangeSet do
131
132
  before do
132
133
  allow(cf_stub).to receive(:wait_until).and_raise(Aws::Waiters::Errors::WaiterFailed)
133
134
  allow(change_set_mock).to receive(:status).and_return("FAILED")
135
+ allow(change_set_mock).to receive(:status_reason).and_return("FAILED")
134
136
  end
135
137
 
136
138
  it 'just deletes the change set' do
@@ -51,6 +51,7 @@ describe 'contain_in_change_set' do
51
51
  it 'fails when there is no matching resource type' do
52
52
  expect(stack).not_to contain_in_change_set("AWS::EC2::Foo", "vpc")
53
53
  end
54
+
54
55
  end
55
56
 
56
57
  context 'an invalid sparkleformation template' do
@@ -69,6 +70,17 @@ describe 'contain_in_change_set' do
69
70
  expect { expect(stack).not_to contain_in_change_set("AWS::EC2::Foo", "vpc") }.to raise_error(CloudFormationRSpec::Sparkle::InvalidSparkleTemplate)
70
71
  end
71
72
  end
73
+
74
+ context 'a stack that fails to generate a change set' do
75
+ before do
76
+ allow(change_set_mock).to receive(:status).and_return("FAILED")
77
+ allow(change_set_mock).to receive(:status_reason).and_return("failed")
78
+ end
79
+
80
+ it 'fails' do
81
+ expect(stack).not_to contain_in_change_set("AWS::EC2::VPC", "Foo")
82
+ end
83
+ end
72
84
  end
73
85
 
74
86
  describe 'have_change_set_failed' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Robinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-14 00:00:00.000000000 Z
11
+ date: 2019-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -73,7 +73,10 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".travis.yml"
77
+ - CODE_OF_CONDUCT.md
76
78
  - Gemfile
79
+ - LICENSE.md
77
80
  - README.md
78
81
  - Rakefile
79
82
  - cloudformation-rspec.gemspec
@@ -115,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
118
  version: '0'
116
119
  requirements: []
117
120
  rubyforge_project:
118
- rubygems_version: 2.7.6
121
+ rubygems_version: 2.6.11
119
122
  signing_key:
120
123
  specification_version: 4
121
124
  summary: Test your CloudFormation templates