cem_win_spec 0.1.8 → 0.1.10

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: 000454f69f3ea2722dcd11ec105a5ebe617301d076a2c1772cb530d8275e0f11
4
- data.tar.gz: 1d2635cc5f330baa755482c5738901e2e79aeabd585200db5ee0ef218cd9decf
3
+ metadata.gz: f78e88ed46fc238a87bd3d95278fbf225c4c43001ee08cbeac1bde53bf4a621e
4
+ data.tar.gz: 4e73a78a8f24afd7c94e6cd6543444521228175277859aeead16903478141231
5
5
  SHA512:
6
- metadata.gz: d8d28e53eeb77001c89b81a9140be2783278c528fa1dc92aef59b7154cd0174fba47b534d346977135e9465115b74981d9bfdd04eb35952a612e80dea71657a4
7
- data.tar.gz: 0d4b7117383ab02ee03c0d8f19f75be611a3e678dd973140844f9316d651db7bc0263ed0f4354fda64893b498a344128adb6e44dcb999030bef66445dc4cd0f9
6
+ metadata.gz: acaa079a43a43cf2cc191cd892ab12dd9ce908bb216e8bd457eeb356d6f53652cd58554e2d069afee7a04f1dc3624dbc91482fd69f9c5733c885df10588a3398
7
+ data.tar.gz: 0315bcb4b2cb6bbbb63d122638fc693012c05b7a0b58a54a4e91d4aaf43d4562dced74e19f43409cf7e1888bd486e263c5f565d52869646ef612ef997bf388f3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cem_win_spec (0.1.8)
4
+ cem_win_spec (0.1.10)
5
5
  parallel_tests (~> 3.4)
6
6
  puppet_forge (~> 4.1)
7
7
  winrm (~> 2.3)
@@ -34,7 +34,7 @@ GEM
34
34
  httpclient (2.8.3)
35
35
  json (2.8.2)
36
36
  little-plugger (1.1.4)
37
- logger (1.6.5)
37
+ logger (1.7.0)
38
38
  logging (2.4.0)
39
39
  little-plugger (~> 1.1)
40
40
  multi_json (~> 1.14)
@@ -111,6 +111,7 @@ GEM
111
111
 
112
112
  PLATFORMS
113
113
  arm64-darwin-22
114
+ arm64-darwin-24
114
115
  x86_64-darwin-19
115
116
  x86_64-darwin-20
116
117
 
@@ -27,6 +27,7 @@ module CemWinSpec
27
27
 
28
28
  def initialize
29
29
  validate_platform!
30
+ configure_forge_authorization!
30
31
  @cache_dir = CACHE_DIR
31
32
  @cache_entries = setup_and_load_cache
32
33
  @entries_digest = hexdigest(@cache_entries.to_s)
@@ -73,6 +74,16 @@ module CemWinSpec
73
74
  raise FixtureCacheError, 'FixtureCache must run on Windows'
74
75
  end
75
76
 
77
+ # Premium/entitled Forge modules (e.g. puppetlabs-security_policy) 401 on
78
+ # PuppetForge::Module.find/Release.find/download without this - the gem
79
+ # makes anonymous requests by default. FORGE_API_KEY matches the env var
80
+ # puppetlabs_spec_helper's spec_prep already reads for the same purpose,
81
+ # so a single secret covers both.
82
+ def configure_forge_authorization!
83
+ token = ENV.fetch('FORGE_API_KEY', nil)
84
+ PuppetForge::Connection.authorization = token unless token.nil? || token.strip.empty?
85
+ end
86
+
76
87
  def hexdigest(str)
77
88
  Digest(:SHA256).hexdigest(str)
78
89
  end
@@ -38,7 +38,7 @@ module CemWinSpec
38
38
 
39
39
  class << self
40
40
  def log_setup!(options = {})
41
- console_l_level = if options[:debug]
41
+ console_l_level = if (options.key?(:debug) && options[:debug]) || ENV['RUNNER_DEBUG']
42
42
  new_log_level('debug')
43
43
  else
44
44
  new_log_level('info')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CemWinSpec
4
- VERSION = "0.1.8"
4
+ VERSION = "0.1.10"
5
5
  end
@@ -49,6 +49,7 @@ module CemWinSpec
49
49
 
50
50
  value['PUPPET_GEM_VERSION'] = "~> #{puppet_version}" if puppet_version
51
51
  value['FACTER_GEM_VERSION'] = 'https://github.com/puppetlabs/facter#main' if puppet_version
52
+ value['FORGE_API_KEY'] = ENV['FORGE_API_KEY'] if ENV['FORGE_API_KEY']
52
53
  value.delete('password') if value.key?('password')
53
54
  @env_vars = value
54
55
  end
data/lib/cem_win_spec.rb CHANGED
@@ -58,8 +58,12 @@ module CemWinSpec
58
58
  case operation
59
59
  when :spec
60
60
  run_spec(runner, module_dir, **options)
61
+ # We set this to 0 if the tests pass because this can be set to 1 earlier by commands that fail and retry.
62
+ self.exit_code = 0
61
63
  when :clean_fixture_cache
62
64
  clean_fixture_cache(runner, module_dir, **options)
65
+ # We set this to 0 if the tests pass because this can be set to 1 earlier by commands that fail and retry.
66
+ self.exit_code = 0
63
67
  else
64
68
  raise ArgumentError, "Unknown operation: #{operation}"
65
69
  end
@@ -144,7 +148,15 @@ module CemWinSpec
144
148
  reuse_tunnel: false,
145
149
  **opts).run
146
150
  end
147
- if output.stderr&.include?('Tests Failed')
151
+ # `output.stderr.include?('Tests Failed')` only catches the specific string
152
+ # parallel_tests prints when some rspec examples fail. It misses any other
153
+ # reason `bundle exec rake cem_win_spec:parallel_spec` can exit non-zero on
154
+ # the remote host - e.g. a `rake aborted!` crash during `cem_win_spec:prep`
155
+ # (fixture cache setup, Hiera data copy, etc.) before rspec ever runs, which
156
+ # never prints "Tests Failed" at all. `ignore_exitcode: true` on the .run
157
+ # call above only suppresses Exec#run's own internal raise; output.exitcode
158
+ # still holds the real remote exit code, so check it too.
159
+ if !output.success? || output.stderr&.include?('Tests Failed')
148
160
  logger.error 'Tests failed'
149
161
  self.exit_code = 1
150
162
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cem_win_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heston Snodgrass
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-02-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: winrm
@@ -124,7 +123,6 @@ metadata:
124
123
  homepage_uri: https://github.com/hsnodgrass/cem_win_spec
125
124
  source_code_uri: https://github.com/hsnodgrass/cem_win_spec
126
125
  changelog_uri: https://github.com/hsnodgrass/cem_win_spec/CHANGELOG.md
127
- post_install_message:
128
126
  rdoc_options: []
129
127
  require_paths:
130
128
  - lib
@@ -139,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
137
  - !ruby/object:Gem::Version
140
138
  version: '0'
141
139
  requirements: []
142
- rubygems_version: 3.5.18
143
- signing_key:
140
+ rubygems_version: 3.7.2
144
141
  specification_version: 4
145
142
  summary: Write a short summary, because RubyGems requires one.
146
143
  test_files: []