test-kitchen 1.23.0 → 1.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 885f8d3b08f1f4c860cd55c370cefc6f2b35e87dc2607ce9f6d60c39788bfd86
4
- data.tar.gz: 352335dacee5a0ed1dbe5067d658bd2cd85bac1d0ec39c49a1283871c8604953
3
+ metadata.gz: 9219cf297ee744f00b2e77febd43103a4cfbbb4b8e12c31e4be80cf66cf30127
4
+ data.tar.gz: d2bad7b27981a7dad6b2a3437a828c91626c196233bd5d81060e6cc91cfc8a9c
5
5
  SHA512:
6
- metadata.gz: cc58bb9f82520bf0e616620a874d0452ac5ed0889cc7e28f0eb1aacfbb8e609436b65ff6f3f687044c3f896fc4846697cf96c78b8adee54816647c9a2f787373
7
- data.tar.gz: '0909b191b4dc6c965ccf6e5afb59b67cff485035b049de9bea218c89f31753312ab970ca68217dc4c7f4eaa6b33ea814f67ce5a9cda3e31a0efa0a66bc2a3dd1'
6
+ metadata.gz: e09373f94e6b8cde1525c248a87c722b629a28d4afa005ca0f512699968898ca119778f8cddc35b8ae03d85802567019e9edd69c8566470df693f6bf0c7ae4fb
7
+ data.tar.gz: 354ab8c97efd79db86a6c2e49533057281c76bbb85a683ef69c2cf640ac8c294db04ee5dd4e0501f7978026b2460cd585f83b7aafc374f6202606fc5d85c6bfa
@@ -0,0 +1 @@
1
+ daysUntilLock: 60
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.23.2](https://github.com/test-kitchen/test-kitchen/tree/v1.23.2) (2018-08-06)
4
+ [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.23.0...v1.23.2)
5
+
6
+ **Closed issues:**
7
+
8
+ - Race condition: conflicting chdir during another chdir block [\#1416](https://github.com/test-kitchen/test-kitchen/issues/1416)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Synchronize calls to chdir to be thread safe [\#1430](https://github.com/test-kitchen/test-kitchen/pull/1430) ([s-bernard](https://github.com/s-bernard))
13
+ - Catch 'Operation already in progress' as seen on Ubuntu on WSL [\#1435](https://github.com/test-kitchen/test-kitchen/pull/1435) ([bdwyertech](https://github.com/bdwyertech))
14
+ - Fix \#1104 add supplemental kitchen commands [\#1105](https://github.com/test-kitchen/test-kitchen/pull/1105) ([4-20ma](https://github.com/4-20ma))
15
+
16
+
3
17
  ## [v1.23.0](https://github.com/test-kitchen/test-kitchen/tree/v1.23.0) (2018-07-30)
4
18
  [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.22.0...v1.23.0)
5
19
 
@@ -61,6 +61,9 @@ module Kitchen
61
61
  # @return [Mutex] a common mutex for global coordination
62
62
  attr_accessor :mutex
63
63
 
64
+ # @return [Mutex] a mutex used for Dir.chdir coordination
65
+ attr_accessor :mutex_chdir
66
+
64
67
  # Returns the root path of the Kitchen gem source code.
65
68
  #
66
69
  # @return [Pathname] root path of gem
@@ -147,3 +150,6 @@ Kitchen.logger = Kitchen.default_logger
147
150
 
148
151
  # Setup a collection of instance crash exceptions for error reporting
149
152
  Kitchen.mutex = Mutex.new
153
+
154
+ # Initialize the mutex for Dir.chdir coordination
155
+ Kitchen.mutex_chdir = Mutex.new
@@ -53,15 +53,28 @@ module Kitchen
53
53
  # @api private
54
54
  def define
55
55
  namespace "kitchen" do
56
+ kitchen_commands = %w{create converge setup verify destroy}
56
57
  config.instances.each do |instance|
57
58
  desc "Run #{instance.name} test instance"
58
59
  task instance.name do
59
60
  instance.test(:always)
60
61
  end
62
+
63
+ kitchen_commands.each do |cmd|
64
+ namespace cmd do
65
+ task instance.name do
66
+ instance.send(cmd)
67
+ end
68
+ desc "Run all #{cmd} instances"
69
+ task "all" => config.instances.map(&:name)
70
+ end
71
+ end
61
72
  end
62
73
 
63
74
  desc "Run all test instances"
64
75
  task "all" => config.instances.map(&:name)
76
+
77
+ kitchen_commands.each { |cmd| task cmd => "#{cmd}:all" }
65
78
  end
66
79
  end
67
80
  end
@@ -229,7 +229,7 @@ module Kitchen
229
229
  PING_COMMAND = "echo '[SSH] Established'".freeze
230
230
 
231
231
  RESCUE_EXCEPTIONS_ON_ESTABLISH = [
232
- Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
232
+ Errno::EACCES, Errno::EALREADY, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
233
233
  Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Errno::EPIPE,
234
234
  Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Net::SSH::ConnectionTimeout,
235
235
  Timeout::Error
@@ -155,25 +155,30 @@ module Kitchen
155
155
  # and doesn't like fake directories (C:\Documents and Settings)
156
156
  # It also does not do any sort of error checking, so things one would
157
157
  # expect to fail just return an empty list
158
+ #
159
+ # @note Dir.chdir is applied to the process, thus it is not thread-safe
160
+ # and must be synchronized.
158
161
  def self.list_directory(path, include_dot: false, recurse: false)
159
162
  # Things (such as tests) are relying on this to not blow up if
160
163
  # the directory does not exist
161
164
  return [] if !Dir.exist?(path)
162
165
 
163
- Dir.chdir(path) do
164
- glob_pattern = if recurse
165
- "**/*"
166
- else
167
- "*"
168
- end
169
- flags = if include_dot
170
- [File::FNM_DOTMATCH]
171
- else
172
- []
173
- end
174
- Dir.glob(glob_pattern, *flags)
175
- .reject { |f| [".", ".."].include?(f) }
176
- .map { |f| File.join(path, f) }
166
+ Kitchen.mutex_chdir.synchronize do
167
+ Dir.chdir(path) do
168
+ glob_pattern = if recurse
169
+ "**/*"
170
+ else
171
+ "*"
172
+ end
173
+ flags = if include_dot
174
+ [File::FNM_DOTMATCH]
175
+ else
176
+ []
177
+ end
178
+ Dir.glob(glob_pattern, *flags)
179
+ .reject { |f| [".", ".."].include?(f) }
180
+ .map { |f| File.join(path, f) }
181
+ end
177
182
  end
178
183
  end
179
184
 
@@ -188,11 +193,16 @@ module Kitchen
188
193
  # @param pattern [String] The pattern to match
189
194
  # @param flags [Integer] You can specify flags you would have passed to Dir.glob
190
195
  # @return Files matching the specified pattern in the given path
196
+ #
197
+ # @note Dir.chdir is applied to the process, thus it is not thread-safe
198
+ # and must be synchronized.
191
199
  def self.safe_glob(path, pattern, *flags)
192
200
  return [] if !Dir.exist?(path)
193
201
 
194
- Dir.chdir(path) do
195
- Dir.glob(pattern, *flags).map { |f| File.join(path, f) }
202
+ Kitchen.mutex_chdir.synchronize do
203
+ Dir.chdir(path) do
204
+ Dir.glob(pattern, *flags).map { |f| File.join(path, f) }
205
+ end
196
206
  end
197
207
  end
198
208
  end
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Kitchen
20
- VERSION = "1.23.0".freeze
20
+ VERSION = "1.23.2".freeze
21
21
  end
@@ -695,8 +695,8 @@ describe Kitchen::Transport::Ssh::Connection do
695
695
 
696
696
  describe "establishing a connection" do
697
697
  [
698
- Errno::EACCES, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
699
- Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH,
698
+ Errno::EACCES, Errno::EALREADY, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
699
+ Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Errno::EPIPE,
700
700
  Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Net::SSH::ConnectionTimeout,
701
701
  Timeout::Error
702
702
  ].each do |klass|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-kitchen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.0
4
+ version: 1.23.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-31 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -319,6 +319,7 @@ extra_rdoc_files: []
319
319
  files:
320
320
  - ".gitattributes"
321
321
  - ".github/ISSUE_TEMPLATE.md"
322
+ - ".github/lock.yml"
322
323
  - ".gitignore"
323
324
  - ".kitchen.appveyor.yml"
324
325
  - ".kitchen.dokken.yml"