test-kitchen 3.1.0 → 3.2.2

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
  SHA256:
3
- metadata.gz: fc5e05dc50e7052b2002a94e950f5691d953c78d5e408b80a0f7f977ab63eb35
4
- data.tar.gz: 43bc1979cc77277d4a3219f82d8fead18e7aa3cf068fb7484f5176ce422c8767
3
+ metadata.gz: 8b57d5ccdfe054fcd290b2a6f4490f92e626d93d3b7c7bdc8704b3029e723392
4
+ data.tar.gz: 4d20fdf60ea362f63918232cf57bcbaebc8cc61d5732d71a80cbbf20961a057e
5
5
  SHA512:
6
- metadata.gz: 12453b3cbf1ef1dfb49b683667fca52502b10a888e9cf953d58c22589ce99dffc9864d550463c80341049f7073aa3c3fb98eb76c4e432aa266956b6a0a86c332
7
- data.tar.gz: bc19f713f60acc0b5437c5b29ab241255a7a82de2b206ba714596bf2a251c0e9a3c21bc152a18e171461ca24d9291098b55baeec474e495f46824782487350b8
6
+ metadata.gz: adc9ea69942bc0938b8da3340ae0abe1ce78f409170c9d3e1d081179121db9508d072fb18232982e16e377d8f5bddbee9b90b887c22cc9039729b3cdc5daf494
7
+ data.tar.gz: eb8caaaf52882d104ff01f46283325f5455cfaf4f0e8a8a4cfa4792430dac560c2fb556727f8cc9f0fc6af877ba06fee687f763b58c0f3f17cac77841526f968
@@ -241,7 +241,7 @@ module Kitchen
241
241
  #{deprecated_config.keys.join("\n")}
242
242
  Run 'kitchen doctor' for details.
243
243
  MSG
244
- warn(warning)
244
+ Error.warn_on_stderr(warning)
245
245
 
246
246
  # Set global var that the deprecation message has been printed
247
247
  @@has_been_warned_of_deprecations = true
@@ -94,6 +94,19 @@ module Kitchen
94
94
  "".center(22, "-"),
95
95
  ]
96
96
  end
97
+
98
+ # Log a warn message on STDERR device.
99
+ # This will help to distinguish between the errors and
100
+ # output when parsing the output from the commands like
101
+ # kitchen diagnose.
102
+ #
103
+ # @params lines [Array<String>] Array of lines that needs to be printed
104
+ def self.warn_on_stderr(lines)
105
+ Array(lines).each do |line|
106
+ line = Color.colorize(line, :blue) if Kitchen.tty?
107
+ $stderr.puts(line)
108
+ end
109
+ end
97
110
  end
98
111
 
99
112
  # Base exception class from which all Kitchen exceptions derive. This class
@@ -69,7 +69,7 @@ module Kitchen
69
69
  README.* VERSION metadata.{json,rb} attributes.rb recipe.rb
70
70
  attributes/**/* definitions/**/* files/**/* libraries/**/*
71
71
  providers/**/* recipes/**/* resources/**/* templates/**/*
72
- ohai/**/*
72
+ ohai/**/* compliance/**/*
73
73
  ).join(",")
74
74
  # to ease upgrades, allow the user to turn deprecation warnings into errors
75
75
  default_config :deprecations_as_errors, false
@@ -681,25 +681,42 @@ module Kitchen
681
681
  chef_cmds(base_cmd).join(separator)
682
682
  end
683
683
 
684
- # Gives an array of command
684
+ # Gives an array of commands
685
685
  # @api private
686
686
  def chef_cmds(base_cmd)
687
- cmd = prefix_command(wrap_shell_code(
688
- [base_cmd, *chef_args(config_filename), last_exit_code].join(" ")
689
- .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
690
- ))
691
-
692
- cmds = [cmd].cycle(config[:multiple_converge].to_i).to_a
693
-
694
- if config[:enforce_idempotency]
695
- idempotent_cmd = prefix_command(wrap_shell_code(
696
- [base_cmd, *chef_args("client_no_updated_resources.rb"), last_exit_code].join(" ")
697
- .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
698
- ))
699
- cmds[-1] = idempotent_cmd
687
+ cmds = []
688
+ num_converges = config[:multiple_converge].to_i
689
+ idempotency = config[:enforce_idempotency]
690
+
691
+ # Execute Chef Client n-1 times, without exiting
692
+ (num_converges - 1).times do
693
+ cmds << wrapped_chef_cmd(base_cmd, config_filename)
700
694
  end
695
+
696
+ # Append another execution with Windows specific Exit code helper or (for
697
+ # idempotency check) a specific config file which assures no changed resources.
698
+ cmds << unless idempotency
699
+ wrapped_chef_cmd(base_cmd, config_filename, append: last_exit_code)
700
+ else
701
+ wrapped_chef_cmd(base_cmd, "client_no_updated_resources.rb", append: last_exit_code)
702
+ end
701
703
  cmds
702
704
  end
705
+
706
+ # Concatenate all arguments and wrap it with shell-specifics
707
+ # @api private
708
+ def wrapped_chef_cmd(base_cmd, configfile, append: "")
709
+ args = []
710
+
711
+ args << base_cmd
712
+ args << chef_args(configfile)
713
+ args << append
714
+
715
+ shell_cmd = args.flatten.join(" ")
716
+ shell_cmd = shell_cmd.prepend(reload_ps1_path) if windows_os?
717
+
718
+ prefix_command(wrap_shell_code(shell_cmd))
719
+ end
703
720
  end
704
721
  end
705
722
  end
@@ -176,9 +176,11 @@ module Kitchen
176
176
  Array(locals).map do |local|
177
177
  opts = File.directory?(local) ? { recursive: true } : {}
178
178
 
179
- waits.push session.scp.upload(local, remote, opts) do |_ch, name, sent, total|
180
- logger.debug("Async Uploaded #{name} (#{total} bytes)") if sent == total
181
- end
179
+ waits.push(
180
+ session.scp.upload(local, remote, opts) do |_ch, name, sent, total|
181
+ logger.debug("Async Uploaded #{name} (#{total} bytes)") if sent == total
182
+ end
183
+ )
182
184
  waits.shift.wait while waits.length >= max_ssh_sessions
183
185
  end
184
186
  waits.each(&:wait)
@@ -16,5 +16,5 @@
16
16
  # limitations under the License.
17
17
 
18
18
  module Kitchen
19
- VERSION = "3.1.0".freeze
19
+ VERSION = "3.2.2".freeze
20
20
  end
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: 3.1.0
4
+ version: 3.2.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: 2021-10-02 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -520,7 +520,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
520
520
  - !ruby/object:Gem::Version
521
521
  version: '0'
522
522
  requirements: []
523
- rubygems_version: 3.2.22
523
+ rubygems_version: 3.2.32
524
524
  signing_key:
525
525
  specification_version: 4
526
526
  summary: Test Kitchen is an integration tool for developing and testing infrastructure