|
541 | 541 |
|
542 | 542 | context 'when the invocation script returns data without errors' do
|
543 | 543 | 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' }) |
545 | 545 | allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
|
546 | 546 | allow(Puppet::Pops::Time::Timestamp).to receive(:parse).with('2100-01-01').and_return('TimeStamp:2100-01-01')
|
547 | 547 | allow(provider).to receive(:fetch_cached_hashes).and_return([])
|
|
659 | 659 | context 'when the DSC invocation errors' do
|
660 | 660 | it 'writes an error and returns nil' do
|
661 | 661 | 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.') |
664 | 664 | expect(result).to be_nil
|
665 | 665 | end
|
666 | 666 | end
|
667 | 667 |
|
668 | 668 | context 'when handling DateTimes' do
|
669 | 669 | 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' }) |
671 | 671 | allow(JSON).to receive(:parse).with('DSC Data').and_return(parsed_invocation_data)
|
672 | 672 | allow(provider).to receive(:fetch_cached_hashes).and_return([])
|
673 | 673 | end
|
|
719 | 719 | context 'when the credential is invalid' do
|
720 | 720 | before do
|
721 | 721 | 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' }) |
723 | 723 | allow(JSON).to receive(:parse).with('DSC Data').and_return({ 'errormessage' => dsc_logon_failure_error })
|
724 | 724 | allow(context).to receive(:err).with(name_hash[:name], puppet_logon_failure_error)
|
725 | 725 | end
|
|
783 | 783 | context 'when the invocation script returns nil' do
|
784 | 784 | it 'errors via context but does not raise' do
|
785 | 785 | 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.') |
787 | 787 | expect { result }.not_to raise_error
|
788 | 788 | end
|
789 | 789 | end
|
|
837 | 837 |
|
838 | 838 | context 'when the invocation script returns data without errors' do
|
839 | 839 | 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}' }) |
841 | 841 | expect(context).not_to receive(:err)
|
842 | 842 | expect(result).to eq({ 'in_desired_state' => true, 'errormessage' => nil })
|
843 | 843 | end
|
|
0 commit comments