Skip to content

Commit

Permalink
(CAT-1869) - Update tests to expect input for timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbreen28 committed Jun 11, 2024
1 parent 0c12e2d commit a6e1419
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@

context 'when the invocation script returns data without errors' do
before do
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
allow(Puppet::Pops::Time::Timestamp).to receive(:parse).with('2100-01-01').and_return('TimeStamp:2100-01-01')
allow(provider).to receive(:fetch_cached_hashes).and_return([])
Expand Down Expand Up @@ -659,15 +659,15 @@
context 'when the DSC invocation errors' do
it 'writes an error and returns nil' do
expect(provider).not_to receive(:logon_failed_already?)
expect(ps_manager).to receive(:execute).with(script).and_return({ stdout: nil })
expect(context).to receive(:err).with('Nothing returned')
expect(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: nil })
expect(context).to receive(:err).with('Nothing returned.')
expect(result).to be_nil
end
end

context 'when handling DateTimes' do
before do
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
allow(provider).to receive(:fetch_cached_hashes).and_return([])
end
Expand Down Expand Up @@ -719,7 +719,7 @@
context 'when the credential is invalid' do
before do
allow(provider).to receive(:logon_failed_already?).and_return(false)
allow(ps_manager).to receive(:execute).with(script).and_return({ stdout: 'DSC Data' })
allow(ps_manager).to receive(:execute).with(script, nil).and_return({ stdout: 'DSC Data' })
allow(JSON).to receive(:parse).with('DSC Data').and_return({ 'errormessage' => dsc_logon_failure_error })
allow(context).to receive(:err).with(name_hash[:name], puppet_logon_failure_error)
end
Expand Down Expand Up @@ -783,7 +783,7 @@
context 'when the invocation script returns nil' do
it 'errors via context but does not raise' do
expect(ps_manager).to receive(:execute).and_return({ stdout: nil })
expect(context).to receive(:err).with('Nothing returned')
expect(context).to receive(:err).with('Nothing returned.')
expect { result }.not_to raise_error
end
end
Expand Down Expand Up @@ -837,7 +837,7 @@

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

0 comments on commit a6e1419

Please sign in to comment.