Skip to content

Commit dd76db3

Browse files
author
jordanbreen28
committed
(CAT-1869) - Update tests to expect input for timeout
1 parent 96e31f0 commit dd76db3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

spec/unit/puppet/provider/dsc_base_provider/dsc_base_provider_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@
541541

542542
context 'when the invocation script returns data without errors' do
543543
before do
544-
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
544+
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
545545
allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
546546
allow(Puppet::Pops::Time::Timestamp).to receive(:parse).with('2100-01-01').and_return('TimeStamp:2100-01-01')
547547
allow(provider).to receive(:fetch_cached_hashes).and_return([])
@@ -659,15 +659,15 @@
659659
context 'when the DSC invocation errors' do
660660
it 'writes an error and returns nil' do
661661
expect(provider).not_to receive(:logon_failed_already?)
662-
expect(ps_manager).to receive(:execute).with(script).and_return({ stdout: nil })
663-
expect(context).to receive(:err).with('Nothing returned')
662+
expect(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: nil })
663+
expect(context).to receive(:err).with('Nothing returned.')
664664
expect(result).to be_nil
665665
end
666666
end
667667

668668
context 'when handling DateTimes' do
669669
before do
670-
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
670+
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
671671
allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
672672
allow(provider).to receive(:fetch_cached_hashes).and_return([])
673673
end
@@ -719,7 +719,7 @@
719719
context 'when the credential is invalid' do
720720
before do
721721
allow(provider).to receive(:logon_failed_already?).and_return(false)
722-
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
722+
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
723723
allow(JSON).to receive(:parse).with('DSC Data').and_return({ 'errormessage' => dsc_logon_failure_error })
724724
allow(context).to receive(:err).with(name_hash[:name], puppet_logon_failure_error)
725725
end
@@ -783,7 +783,7 @@
783783
context 'when the invocation script returns nil' do
784784
it 'errors via context but does not raise' do
785785
expect(ps_manager).to receive(:execute).and_return({ stdout: nil })
786-
expect(context).to receive(:err).with('Nothing returned')
786+
expect(context).to receive(:err).with('Nothing returned.')
787787
expect { result }.not_to raise_error
788788
end
789789
end
@@ -837,7 +837,7 @@
837837

838838
context 'when the invocation script returns data without errors' do
839839
it 'filters for the correct properties to invoke and returns the results' do
840-
expect(ps_manager).to receive(:execute).with("Script: #{apply_props}").and_return({ stdout: '{"in_desired_state": true, "errormessage": null}' })
840+
expect(ps_manager).to receive(:execute).with("Script: #{apply_props}", nil).and_return({ stdout: '{"in_desired_state": true, "errormessage": null}' })
841841
expect(context).not_to receive(:err)
842842
expect(result).to eq({ 'in_desired_state' => true, 'errormessage' => nil })
843843
end

0 commit comments

Comments
 (0)