test-kitchen 4.1.2 → 4.1.3
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 +4 -4
- data/lib/kitchen/base64_stream.rb +2 -2
- data/lib/kitchen/configurable.rb +1 -1
- data/lib/kitchen/instance.rb +2 -0
- data/lib/kitchen/provisioner/shell.rb +1 -1
- data/lib/kitchen/shell_out.rb +2 -0
- data/lib/kitchen/transport/winrm.rb +1 -1
- data/lib/kitchen/util.rb +29 -2
- data/lib/kitchen/verifier/busser.rb +2 -2
- data/lib/kitchen/version.rb +1 -1
- data/lib/kitchen.rb +16 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35bb40be8e39ac171865c0bd23300293032f6558dbb62d788efcb1441dbbe66c
|
|
4
|
+
data.tar.gz: d9d9be6360a468f2cd55958e37a21a1f0b1ffa4435a0eb53dc84dae07a219369
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75dce025d9f85c60bb7b07cbc30f809d864eb2cdbf562557e9511376c050ae1b41f488ed3640dddf11c4664fa91ab5a048a7e5d434d0c1172195eaa055289276
|
|
7
|
+
data.tar.gz: dda50545d44c4c3522f28df5dd89eeeefb1356d3e349abfc22f0899ced79ed58b7eaa300a764a239e182ecec384dc8a39e76ad27cbf5e86dba48c8efbf0c63ea
|
|
@@ -28,7 +28,7 @@ module Kitchen
|
|
|
28
28
|
# @param io_in [#read] input stream
|
|
29
29
|
# @param io_out [#write] output stream
|
|
30
30
|
def self.strict_encode(io_in, io_out)
|
|
31
|
-
buffer = ""
|
|
31
|
+
buffer = +"" # mutable: IO#read writes into this buffer
|
|
32
32
|
io_out.write([buffer].pack("m0")) while io_in.read(3 * 1000, buffer)
|
|
33
33
|
buffer = nil # rubocop:disable Lint/UselessAssignment
|
|
34
34
|
end
|
|
@@ -40,7 +40,7 @@ module Kitchen
|
|
|
40
40
|
# @param io_in [#read] input stream
|
|
41
41
|
# @param io_out [#write] output stream
|
|
42
42
|
def self.strict_decode(io_in, io_out)
|
|
43
|
-
buffer = ""
|
|
43
|
+
buffer = +"" # mutable: IO#read writes into this buffer
|
|
44
44
|
io_out.write(buffer.unpack("m0").first) while io_in.read(3 * 1000, buffer)
|
|
45
45
|
buffer = nil # rubocop:disable Lint/UselessAssignment
|
|
46
46
|
end
|
data/lib/kitchen/configurable.rb
CHANGED
|
@@ -247,7 +247,7 @@ module Kitchen
|
|
|
247
247
|
@deprecated_config = deprecated_attributes.delete_if { |attr, obj| !provided_config.key?(attr) || obj.nil? }
|
|
248
248
|
|
|
249
249
|
unless deprecated_config.empty?
|
|
250
|
-
warning = Util.outdent
|
|
250
|
+
warning = Util.outdent(<<-MSG)
|
|
251
251
|
Deprecated configuration detected:
|
|
252
252
|
#{deprecated_config.keys.join("\n")}
|
|
253
253
|
Run 'kitchen doctor' for details.
|
data/lib/kitchen/instance.rb
CHANGED
|
@@ -20,6 +20,8 @@ require "fileutils" unless defined?(FileUtils)
|
|
|
20
20
|
require "securerandom" unless defined?(SecureRandom)
|
|
21
21
|
require "time" unless defined?(Time.zone_offset)
|
|
22
22
|
|
|
23
|
+
require_relative "logging"
|
|
24
|
+
|
|
23
25
|
module Kitchen
|
|
24
26
|
# An instance of a suite running on a platform. A created instance may be a
|
|
25
27
|
# local virtual machine, cloud instance, container, or even a bare metal
|
data/lib/kitchen/shell_out.rb
CHANGED
|
@@ -247,7 +247,7 @@ module Kitchen
|
|
|
247
247
|
# Mac system
|
|
248
248
|
# @api private
|
|
249
249
|
def create_rdp_doc(opts = {})
|
|
250
|
-
content = Util.outdent
|
|
250
|
+
content = Util.outdent(<<-RDP)
|
|
251
251
|
full address:s:#{URI.parse(options[:endpoint]).host}:#{rdp_port}
|
|
252
252
|
prompt for credentials:i:1
|
|
253
253
|
username:s:#{options[:user]}
|
data/lib/kitchen/util.rb
CHANGED
|
@@ -24,6 +24,17 @@ module Kitchen
|
|
|
24
24
|
#
|
|
25
25
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
|
26
26
|
module Util
|
|
27
|
+
class << self
|
|
28
|
+
# @return [Mutex] a mutex used to serialize the process-global Dir.chdir
|
|
29
|
+
attr_accessor :mutex_chdir
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Dir.chdir mutates process-global state, so every call has to be
|
|
33
|
+
# serialized. The mutex is owned here rather than in lib/kitchen.rb
|
|
34
|
+
# because Util is its only consumer and has to keep working when
|
|
35
|
+
# "kitchen/util" is required on its own.
|
|
36
|
+
@mutex_chdir = Mutex.new
|
|
37
|
+
|
|
27
38
|
# Returns the standard library Logger level constants for a given symbol
|
|
28
39
|
# representation.
|
|
29
40
|
#
|
|
@@ -146,6 +157,22 @@ module Kitchen
|
|
|
146
157
|
string.gsub!(/^ {#{string.index(/[^ ]/)}}/, "")
|
|
147
158
|
end
|
|
148
159
|
|
|
160
|
+
# Returns a copy of a string with each line outdented by the indentation
|
|
161
|
+
# level of its first line.
|
|
162
|
+
#
|
|
163
|
+
# Prefer this over {.outdent!} when the input may be a string literal:
|
|
164
|
+
# Ruby 4 freezes literals, and mutating one raises a FrozenError.
|
|
165
|
+
#
|
|
166
|
+
# @param string [String] the string to outdent
|
|
167
|
+
# @return [String] a new, outdented string
|
|
168
|
+
# @example
|
|
169
|
+
#
|
|
170
|
+
# string = " a\n b\n c\n"
|
|
171
|
+
# Util.outdent(string) # => "a\n b\nc\n"
|
|
172
|
+
def self.outdent(string)
|
|
173
|
+
string.gsub(/^ {#{string.index(/[^ ]/)}}/, "")
|
|
174
|
+
end
|
|
175
|
+
|
|
149
176
|
# Returns a set of Bourne Shell (AKA /bin/sh) compatible helper
|
|
150
177
|
# functions. This function is usually called inline in a string that
|
|
151
178
|
# will be executed remotely on a test instance.
|
|
@@ -178,7 +205,7 @@ module Kitchen
|
|
|
178
205
|
# the directory does not exist
|
|
179
206
|
return [] unless Dir.exist?(path)
|
|
180
207
|
|
|
181
|
-
|
|
208
|
+
mutex_chdir.synchronize do
|
|
182
209
|
Dir.chdir(path) do
|
|
183
210
|
glob_pattern = if recurse
|
|
184
211
|
"**/*"
|
|
@@ -214,7 +241,7 @@ module Kitchen
|
|
|
214
241
|
def self.safe_glob(path, pattern, *flags)
|
|
215
242
|
return [] unless Dir.exist?(path)
|
|
216
243
|
|
|
217
|
-
|
|
244
|
+
mutex_chdir.synchronize do
|
|
218
245
|
Dir.chdir(path) do
|
|
219
246
|
Dir.glob(pattern, *flags).map { |f| File.join(path, f) }
|
|
220
247
|
end
|
|
@@ -72,7 +72,7 @@ module Kitchen
|
|
|
72
72
|
cmd = sudo(config[:busser_bin]).dup
|
|
73
73
|
.tap { |str| str.insert(0, "& ") if powershell_shell? }
|
|
74
74
|
|
|
75
|
-
prefix_command(wrap_shell_code(Util.outdent
|
|
75
|
+
prefix_command(wrap_shell_code(Util.outdent(<<-CMD)))
|
|
76
76
|
#{busser_env}
|
|
77
77
|
|
|
78
78
|
#{cmd} suite cleanup
|
|
@@ -95,7 +95,7 @@ module Kitchen
|
|
|
95
95
|
cmd = sudo(config[:busser_bin]).dup
|
|
96
96
|
.tap { |str| str.insert(0, "& ") if powershell_shell? }
|
|
97
97
|
|
|
98
|
-
prefix_command(wrap_shell_code(Util.outdent
|
|
98
|
+
prefix_command(wrap_shell_code(Util.outdent(<<-CMD)))
|
|
99
99
|
#{busser_env}
|
|
100
100
|
|
|
101
101
|
#{cmd} test #{plugins.join(" ").gsub!("busser-", "")}
|
data/lib/kitchen/version.rb
CHANGED
data/lib/kitchen.rb
CHANGED
|
@@ -57,8 +57,23 @@ module Kitchen
|
|
|
57
57
|
# @return [Mutex] a common mutex for global coordination
|
|
58
58
|
attr_accessor :mutex
|
|
59
59
|
|
|
60
|
+
# Returns the mutex used for Dir.chdir coordination.
|
|
61
|
+
#
|
|
60
62
|
# @return [Mutex] a mutex used for Dir.chdir coordination
|
|
61
|
-
|
|
63
|
+
# @deprecated Use {Kitchen::Util.mutex_chdir}, which owns the mutex and is
|
|
64
|
+
# available without loading all of Test Kitchen.
|
|
65
|
+
def mutex_chdir
|
|
66
|
+
Kitchen::Util.mutex_chdir
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Sets the mutex used for Dir.chdir coordination.
|
|
70
|
+
#
|
|
71
|
+
# @param mutex [Mutex] the mutex to use for Dir.chdir coordination
|
|
72
|
+
# @return [Mutex] the newly set mutex
|
|
73
|
+
# @deprecated Use {Kitchen::Util.mutex_chdir=}.
|
|
74
|
+
def mutex_chdir=(mutex)
|
|
75
|
+
Kitchen::Util.mutex_chdir = mutex
|
|
76
|
+
end
|
|
62
77
|
|
|
63
78
|
# @return [String] identifier for the current Kitchen process invocation
|
|
64
79
|
attr_writer :run_id
|
|
@@ -164,6 +179,3 @@ Kitchen.logger = Kitchen.default_logger
|
|
|
164
179
|
|
|
165
180
|
# Set up a collection of instance crash exceptions for error reporting
|
|
166
181
|
Kitchen.mutex = Mutex.new
|
|
167
|
-
|
|
168
|
-
# Initialize the mutex for Dir.chdir coordination
|
|
169
|
-
Kitchen.mutex_chdir = Mutex.new
|
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: 4.1.
|
|
4
|
+
version: 4.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fletcher Nichol
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bcrypt_pbkdf
|