kitchen-inspec 0.11.0 → 0.11.1

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
2
  SHA1:
3
- metadata.gz: 0b9092e5aaf9e8e5afc182fdef46eb884d2228e5
4
- data.tar.gz: c6d012ff3e90f865f0103c6c75c6a13a1cc29978
3
+ metadata.gz: 3f9bc4f575ab5d4bb5c163ef5901e058da4b2ffd
4
+ data.tar.gz: b4a36fad7ab71d00438a7c632d1108ade8ffce33
5
5
  SHA512:
6
- metadata.gz: d68aaf5daf6acbd5fbfd03fa04dcf0566a36847f19508c57bb737d1815ce0dc8a599b6a71337a6bd07b1f796dc7607da2164788dbec06c3099ba95f7f2b4eb6e
7
- data.tar.gz: bf27169f51788ddfbdc179295a50285d2e685d95482a9a1ccb55920cd7257de80914644e69f6de44924baf6c7c1c8a6d1c113500ca80334db6ec71faa6df250e
6
+ metadata.gz: c8b0fe1548b0243766c477a3b940411a2d62f8b0c5f01357200de9b614def92292f893aeef69ea09b3305750e0ed691ce3341bf82be8dfd250dc763101b4908a
7
+ data.tar.gz: 5cacab6d53b19dff229555da70c390a896dbe454889b7a689b35be5695f24b653f33592539cc0526105a2e8b8e0ca2636ff9afbcf453a11256a59c1fa5c711a6
data/.travis.yml CHANGED
@@ -17,15 +17,10 @@ before_install:
17
17
  matrix:
18
18
  include:
19
19
  - rvm: 1.9.3
20
- gemfile: Gemfile.193
21
20
  - rvm: 2.0
22
- gemfile: Gemfile
23
21
  - rvm: 2.1
24
- gemfile: Gemfile
25
22
  - rvm: ruby-head
26
- gemfile: Gemfile
27
23
  - rvm: 2.2
28
- gemfile: Gemfile
29
24
  bundler_args: --without guard tools
30
25
  script: bundle exec rake test:integration
31
26
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,7 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [0.11.0](https://github.com/chef/kitchen-inspec/tree/0.11.0) (2016-02-02)
4
- [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.10.1...0.11.0)
3
+ ## [0.11.1](https://github.com/chef/kitchen-inspec/tree/0.11.1) (2016-02-15)
4
+ [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.11.0...0.11.1)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - bugfix: use the right container in combination with kitchen-dokken [\#43](https://github.com/chef/kitchen-inspec/pull/43) ([chris-rock](https://github.com/chris-rock))
9
+
10
+ **Merged pull requests:**
11
+
12
+ - deduplicate Gemfiles [\#41](https://github.com/chef/kitchen-inspec/pull/41) ([srenatus](https://github.com/srenatus))
13
+ - work well with other testing frameworks in test-kitchen [\#40](https://github.com/chef/kitchen-inspec/pull/40) ([chris-rock](https://github.com/chris-rock))
14
+
15
+ ## [v0.11.0](https://github.com/chef/kitchen-inspec/tree/v0.11.0) (2016-02-08)
16
+ [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.10.1...v0.11.0)
5
17
 
6
18
  **Implemented enhancements:**
7
19
 
@@ -12,6 +24,10 @@
12
24
  - Failures should be tagged with the instance they failed against [\#30](https://github.com/chef/kitchen-inspec/issues/30)
13
25
  - kitchen verify has exit status 0 with failed examples [\#9](https://github.com/chef/kitchen-inspec/issues/9)
14
26
 
27
+ **Merged pull requests:**
28
+
29
+ - 0.11.0 [\#38](https://github.com/chef/kitchen-inspec/pull/38) ([chris-rock](https://github.com/chris-rock))
30
+
15
31
  ## [v0.10.1](https://github.com/chef/kitchen-inspec/tree/v0.10.1) (2016-01-15)
16
32
  [Full Changelog](https://github.com/chef/kitchen-inspec/compare/v0.10.0...v0.10.1)
17
33
 
data/Gemfile CHANGED
@@ -18,6 +18,12 @@ group :test do
18
18
  gem 'test-kitchen', git: 'https://github.com/test-kitchen/test-kitchen.git', branch: 'chris-rock/winrm-properties-fix'
19
19
  end
20
20
 
21
+ # pin dependency for Ruby 1.9.3 since bundler is not
22
+ # detecting that net-ssh 3 does not work with 1.9.3
23
+ if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.9.3')
24
+ gem 'net-ssh', '~> 2.9'
25
+ end
26
+
21
27
  group :integration do
22
28
  gem 'berkshelf'
23
29
  gem 'kitchen-dokken'
data/README.md CHANGED
@@ -30,6 +30,46 @@ verifier:
30
30
  name: inspec
31
31
  ```
32
32
 
33
+ ### Directory Structure
34
+
35
+ By default `kitchen-inspec` expects test to be in `test/integration/%suite%` directory structure (we use Chef as provisioner here):
36
+
37
+ ```
38
+ .
39
+ ├── Berksfile
40
+ ├── Gemfile
41
+ ├── README.md
42
+ ├── metadata.rb
43
+ ├── recipes
44
+ │   ├── default.rb
45
+ │   └── nginx.rb
46
+ └── test
47
+ └── integration
48
+ └── default
49
+ └── web_spec.rb
50
+ ```
51
+
52
+
53
+ ### Combination with other testing frameworks
54
+
55
+ If you need support with other testing frameworks, we recommend to place the tests in `test/integration/%suite%/inspec`:
56
+
57
+ ```
58
+ .
59
+ ├── Berksfile
60
+ ├── Gemfile
61
+ ├── README.md
62
+ ├── metadata.rb
63
+ ├── recipes
64
+ │   ├── default.rb
65
+ │   └── nginx.rb
66
+ └── test
67
+ └── integration
68
+ └── default
69
+ └── inspec
70
+ └── web_spec.rb
71
+ ```
72
+
33
73
  ## Development
34
74
 
35
75
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -23,13 +23,14 @@ require 'kitchen/verifier/inspec_version'
23
23
  require 'kitchen/verifier/base'
24
24
 
25
25
  require 'uri'
26
+ require 'pathname'
26
27
 
27
28
  module Kitchen
28
29
  module Verifier
29
30
  # InSpec verifier for Kitchen.
30
31
  #
31
32
  # @author Fletcher Nichol <fnichol@chef.io>
32
- class Inspec < Kitchen::Verifier::Base
33
+ class Inspec < Kitchen::Verifier::Base # rubocop:disable Metrics/ClassLength
33
34
  kitchen_verifier_api_version 1
34
35
  plugin_version Kitchen::Verifier::INSPEC_VERSION
35
36
 
@@ -76,12 +77,30 @@ module Kitchen
76
77
  # residing on the local workstation. Any special provisioner-specific
77
78
  # directories (such as a Chef roles/ directory) are excluded.
78
79
  #
80
+ # we support the base directories
81
+ # - test/integration
82
+ # - test/integration/inspec (prefered if used with other test environments)
83
+ #
79
84
  # @return [Array<String>] array of suite files
80
85
  # @api private
81
86
  def local_suite_files
82
87
  base = File.join(config[:test_base_path], config[:suite_name])
83
- glob = File.join(base, '**/*_spec.rb')
84
- Dir.glob(glob).reject do |f|
88
+ legacy_mode = false
89
+ # check for other testing frameworks, we may need to add more
90
+ %w{serverspec bats pester rspec cucumber minitest bash}.each { |fw|
91
+ if Pathname.new(File.join(config[:test_base_path], fw)).exist?
92
+ logger.info("Detected alternative framework tests for `#{fw}`")
93
+ legacy_mode = true
94
+ end
95
+ }
96
+
97
+ base = File.join(base, 'inspec') if legacy_mode
98
+ logger.info("Search `#{base}` for tests")
99
+ filter_chef_files(base, '**/*_spec.rb')
100
+ end
101
+
102
+ def filter_chef_files(base, filter)
103
+ Dir.glob(File.join(base, filter)).reject do |f|
85
104
  chef_data_dir?(base, f) || File.directory?(f)
86
105
  end
87
106
  end
@@ -112,7 +131,6 @@ module Kitchen
112
131
  # @api private
113
132
  def runner_options_for_ssh(config_data)
114
133
  kitchen = instance.transport.send(:connection_options, config_data).dup
115
-
116
134
  opts = {
117
135
  'backend' => 'ssh',
118
136
  'logger' => logger,
@@ -132,7 +150,6 @@ module Kitchen
132
150
  }
133
151
  opts['key_files'] = kitchen[:keys] unless kitchen[:keys].nil?
134
152
  opts['password'] = kitchen[:password] unless kitchen[:password].nil?
135
-
136
153
  opts
137
154
  end
138
155
 
@@ -142,7 +159,6 @@ module Kitchen
142
159
  # @api private
143
160
  def runner_options_for_winrm(config_data)
144
161
  kitchen = instance.transport.send(:connection_options, config_data).dup
145
-
146
162
  opts = {
147
163
  'backend' => 'winrm',
148
164
  'logger' => logger,
@@ -154,7 +170,6 @@ module Kitchen
154
170
  'connection_retry_sleep' => kitchen[:connection_retry_sleep],
155
171
  'max_wait_until_ready' => kitchen[:max_wait_until_ready],
156
172
  }
157
-
158
173
  opts
159
174
  end
160
175
 
@@ -164,17 +179,20 @@ module Kitchen
164
179
  # @api private
165
180
  def runner_options_for_docker(config_data)
166
181
  kitchen = instance.transport.send(:connection_options, config_data).dup
167
-
182
+ #
183
+ # Note: kitchen-dokken uses two containers the
184
+ # - config_data[:data_container][:Id] : (hosts chef-client)
185
+ # - config_data[:runner_container][:Id] : (the kitchen-container)
168
186
  opts = {
169
187
  'backend' => 'docker',
170
188
  'logger' => logger,
171
- 'host' => kitchen[:data_container][:Id],
189
+ 'host' => config_data[:runner_container][:Id],
172
190
  'connection_timeout' => kitchen[:timeout],
173
191
  'connection_retries' => kitchen[:connection_retries],
174
192
  'connection_retry_sleep' => kitchen[:connection_retry_sleep],
175
193
  'max_wait_until_ready' => kitchen[:max_wait_until_ready],
176
194
  }
177
-
195
+ logger.debug "Connect to Container: #{opts['host']}"
178
196
  opts
179
197
  end
180
198
  end
@@ -20,6 +20,6 @@
20
20
  module Kitchen
21
21
  module Verifier
22
22
  # Version string for InSpec Kitchen verifier
23
- INSPEC_VERSION = '0.11.0'
23
+ INSPEC_VERSION = '0.11.1'
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-inspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-08 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inspec
@@ -121,7 +121,6 @@ files:
121
121
  - ".travis.yml"
122
122
  - CHANGELOG.md
123
123
  - Gemfile
124
- - Gemfile.193
125
124
  - Guardfile
126
125
  - LICENSE
127
126
  - README.md
data/Gemfile.193 DELETED
@@ -1,33 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- source 'https://rubygems.org'
3
- gemspec
4
-
5
- # pin dependency for Ruby 1.9.3 since bundler is not
6
- # detecting that net-ssh 3 does not work with 1.9.3
7
- gem 'net-ssh', '~> 2.9'
8
-
9
- group :guard do
10
- gem 'guard-rspec', :require => nil
11
- gem 'guard-rubocop', :require => nil
12
- end
13
-
14
- group :test do
15
- gem 'bundler', '~> 1.5'
16
- gem 'minitest', '~> 5.5'
17
- gem 'rake', '~> 10'
18
- gem 'rubocop', '~> 0.32'
19
- gem 'concurrent-ruby', '~> 0.9'
20
- gem 'codeclimate-test-reporter', :require => nil
21
- # gem 'test-kitchen', '~> 1.5'
22
- gem 'test-kitchen', git: 'https://github.com/test-kitchen/test-kitchen.git', branch: 'chris-rock/winrm-properties-fix'
23
- end
24
-
25
- group :integration do
26
- gem 'berkshelf'
27
- gem 'kitchen-dokken'
28
- end
29
-
30
- group :tools do
31
- gem 'pry', '~> 0.10'
32
- gem 'github_changelog_generator', '~> 1'
33
- end