|
74 | 74 |
|
75 | 75 | it "should call #{provider_name} install for :installed" do
|
76 | 76 | allow(resource).to receive(:should).with(:ensure).and_return(:installed)
|
77 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, 'mypackage']) |
| 77 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, 'mypackage']) |
78 | 78 | provider.install
|
79 | 79 | end
|
80 | 80 |
|
|
86 | 86 |
|
87 | 87 | it "should catch #{provider_name} install failures when status code is wrong" do
|
88 | 88 | allow(resource).to receive(:should).with(:ensure).and_return(:installed)
|
89 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-e', error_level, '-y', :install, name]).and_return(Puppet::Util::Execution::ProcessOutput.new("No package #{name} available.", 0)) |
| 89 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, name]).and_return(Puppet::Util::Execution::ProcessOutput.new("No package #{name} available.", 0)) |
90 | 90 | expect {
|
91 | 91 | provider.install
|
92 | 92 | }.to raise_error(Puppet::Error, "Could not find package #{name}")
|
|
102 | 102 | it 'should be able to set version' do
|
103 | 103 | version = '1.2'
|
104 | 104 | resource[:ensure] = version
|
105 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, "#{name}-#{version}"]) |
| 105 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, "#{name}-#{version}"]) |
106 | 106 | allow(provider).to receive(:query).and_return(:ensure => version)
|
107 | 107 | provider.install
|
108 | 108 | end
|
109 | 109 | it 'should handle partial versions specified' do
|
110 | 110 | version = '1.3.4'
|
111 | 111 | resource[:ensure] = version
|
112 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, 'mypackage-1.3.4']) |
| 112 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, 'mypackage-1.3.4']) |
113 | 113 | allow(provider).to receive(:query).and_return(:ensure => '1.3.4-1.el6')
|
114 | 114 | provider.install
|
115 | 115 | end
|
|
118 | 118 | current_version = '1.2'
|
119 | 119 | version = '1.0'
|
120 | 120 | resource[:ensure] = '1.0'
|
121 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :downgrade, "#{name}-#{version}"]) |
| 121 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :downgrade, "#{name}-#{version}"]) |
122 | 122 | allow(provider).to receive(:query).and_return({:ensure => current_version}, {:ensure => version})
|
123 | 123 | provider.install
|
124 | 124 | end
|
|
127 | 127 | current_version = '1.0'
|
128 | 128 | version = '1.2'
|
129 | 129 | resource[:ensure] = '1.2'
|
130 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', upgrade_command, "#{name}-#{version}"]) |
| 130 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', upgrade_command, "#{name}-#{version}"]) |
131 | 131 | allow(provider).to receive(:query).and_return({:ensure => current_version}, {:ensure => version})
|
132 | 132 | provider.install
|
133 | 133 | end
|
|
136 | 136 | current_version = ''
|
137 | 137 | version = '1.2'
|
138 | 138 | resource[:ensure] = :latest
|
139 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, name]) |
| 139 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, name]) |
140 | 140 | allow(provider).to receive(:query).and_return({:ensure => current_version}, {:ensure => version})
|
141 | 141 | provider.install
|
142 | 142 | end
|
|
145 | 145 | current_version = '1.0'
|
146 | 146 | version = '1.2'
|
147 | 147 | resource[:ensure] = :latest
|
148 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', upgrade_command, name]) |
| 148 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', upgrade_command, name]) |
149 | 149 | allow(provider).to receive(:query).and_return({:ensure => current_version}, {:ensure => version})
|
150 | 150 | provider.install
|
151 | 151 | end
|
152 | 152 |
|
153 | 153 | it 'should accept install options' do
|
154 | 154 | resource[:ensure] = :installed
|
155 | 155 | resource[:install_options] = ['-t', {'-x' => 'expackage'}]
|
156 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', ['-t', '-x=expackage'], :install, name]) |
| 156 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', ['-t', '-x=expackage'], :install, name]) |
157 | 157 | provider.install
|
158 | 158 | end
|
159 | 159 |
|
160 | 160 | it 'allow virtual packages' do
|
161 | 161 | resource[:ensure] = :installed
|
162 | 162 | resource[:allow_virtual] = true
|
163 |
| - expect(Puppet::Util::Execution).not_to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :list, name]) |
164 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, name]) |
| 163 | + expect(Puppet::Util::Execution).not_to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :list, name]) |
| 164 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, name]) |
165 | 165 | provider.install
|
166 | 166 | end
|
167 | 167 |
|
168 | 168 | it 'moves architecture to end of version' do
|
169 | 169 | version = '1.2.3'
|
170 | 170 | arch_resource[:ensure] = version
|
171 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, "#{name}-#{version}.#{arch}"]) |
| 171 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, "#{name}-#{version}.#{arch}"]) |
172 | 172 | allow(arch_provider).to receive(:query).and_return(:ensure => version)
|
173 | 173 | arch_provider.install
|
174 | 174 | end
|
|
180 | 180 | :ensure => version,
|
181 | 181 | :provider =>provider_name
|
182 | 182 | )
|
183 |
| - expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-d', '0', '-e', error_level, '-y', :install, "#{name}-noarch-#{version}"]) |
| 183 | + expect(Puppet::Util::Execution).to receive(:execute).with(["/usr/bin/#{provider_name}", '-y', :install, "#{name}-noarch-#{version}"]) |
184 | 184 | provider = provider_class.new
|
185 | 185 | provider.resource = resource
|
186 | 186 | allow(provider).to receive(:query).and_return(:ensure => version)
|
|
0 commit comments