Skip to content

Commit ccf8105

Browse files
committed
add --debug
1 parent 775c5da commit ccf8105

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

spec/acceptance/deferred_spec.rb

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# spec/acceptance/deferred_spec.rb
21
# frozen_string_literal: true
32

3+
# Helper methods to default debug: true for apply_manifest and idempotent_apply
4+
def apply_manifest_debug(manifest, **opts)
5+
apply_manifest(manifest, { debug: true }.merge(opts))
6+
end
7+
8+
def idempotent_apply_debug(manifest, **opts)
9+
idempotent_apply(manifest, { debug: true }.merge(opts))
10+
end
411
require 'spec_helper_acceptance'
512

613
def read_fixture(name)
@@ -20,20 +27,20 @@ def read_win_file_if_exists(path)
2027
describe 'deferred values with dsc_lite' do
2128
let(:control_manifest) { read_fixture('01_file_deferred.pp') }
2229
let(:dsc_deferred_direct) { read_fixture('02_dsc_deferred_direct.pp') }
23-
let(:dsc_deferred_inline) { read_fixture('02b_dsc_deferred_inline.pp') } # <— NEW
30+
let(:dsc_deferred_inline) { read_fixture('02b_dsc_deferred_inline.pp') } # NEW
2431
let(:dsc_deferred_stringified) { read_fixture('03a_dsc_deferred_stringified.pp') }
2532
let(:dsc_deferred_bad_unwrap) { read_fixture('03b_dsc_deferred_bad_unwrap.pp') }
2633

2734
it 'control (01): native file + Deferred resolves to hello-file' do
28-
result = idempotent_apply(control_manifest)
35+
result = idempotent_apply_debug(control_manifest)
2936
expect(result.exit_code).to eq(0)
3037
out = read_win_file_if_exists('C:/Temp/deferred_ok.txt')
3138
expect(out[:exists]).to be(true)
3239
expect(out[:content].strip).to eq('hello-file')
3340
end
3441

3542
it '02: passing Deferred via variable to DSC resolves to hello-dsc (otherwise flag bug)' do
36-
apply = apply_manifest(dsc_deferred_direct)
43+
apply = apply_manifest_debug(dsc_deferred_direct)
3744
out = read_win_file_if_exists('C:/Temp/from_dsc.txt')
3845
content = out[:content].strip
3946
if out[:exists] && content == 'hello-dsc'
@@ -47,7 +54,7 @@ def read_win_file_if_exists(path)
4754

4855
# NEW 02b: inline Deferred on the DSC property (no variable intermediary)
4956
it '02b: passing Deferred inline to DSC resolves to hello-dsc-inline (otherwise flag bug)' do
50-
apply = apply_manifest(dsc_deferred_inline)
57+
apply = apply_manifest_debug(dsc_deferred_inline)
5158
out = read_win_file_if_exists('C:/Temp/from_dsc_inline.txt')
5259
content = out[:content].strip
5360
if out[:exists] && content == 'hello-dsc-inline'
@@ -60,15 +67,15 @@ def read_win_file_if_exists(path)
6067
end
6168

6269
it '03a: stringifying a Deferred writes the function form (reproduces customer report)' do
63-
apply_manifest(dsc_deferred_stringified)
70+
apply_manifest_debug(dsc_deferred_stringified)
6471
out = read_win_file_if_exists('C:/Temp/from_dsc_var_string.txt')
6572
expect(out[:exists]).to be(true)
6673
expect(out[:content]).to match(%r{Deferred\s*\(|Puppet::Pops::Types::Deferred}i)
6774
expect(out[:content]).not_to match(%r{\bhello-var\b})
6875
end
6976

7077
it '03b: unwrap on a non‑Sensitive is a no‑op; also writes the function form' do
71-
apply_manifest(dsc_deferred_bad_unwrap)
78+
apply_manifest_debug(dsc_deferred_bad_unwrap)
7279
out = read_win_file_if_exists('C:/Temp/from_dsc_var_bad_unwrap.txt')
7380
out = read_win_file_if_exists('C:/Temp/from_dsc_var.txt') unless out[:exists]
7481
expect(out[:exists]).to be(true)

0 commit comments

Comments
 (0)