diff options
author | Matt Wrock <matt@mattwrock.com> | 2016-01-11 15:31:52 -0800 |
---|---|---|
committer | Matt Wrock <matt@mattwrock.com> | 2016-01-11 15:31:52 -0800 |
commit | b60bbc9a8d88f99fce913f63c629201f670fc43a (patch) | |
tree | 296992e25999e6140e1814792ebfa8ffffad9d0a /spec | |
parent | 0944320b72ee1ab16a18a149f5ecb743ace0c0d3 (diff) | |
download | chef-b60bbc9a8d88f99fce913f63c629201f670fc43a.tar.gz |
fexes #4354 and fiexs #4372 stop trying to auto detect versions for exe installersno_version_detect
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/windows_package_spec.rb | 15 | ||||
-rw-r--r-- | spec/unit/provider/package/windows/exe_spec.rb | 74 |
2 files changed, 8 insertions, 81 deletions
diff --git a/spec/functional/resource/windows_package_spec.rb b/spec/functional/resource/windows_package_spec.rb index f5fdc9ef3d..957f357846 100644 --- a/spec/functional/resource/windows_package_spec.rb +++ b/spec/functional/resource/windows_package_spec.rb @@ -37,11 +37,11 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do new_resource end - describe "multi package scenario" do + describe "install package" do let(:pkg_name) { 'Microsoft Visual C++ 2005 Redistributable' } + let(:pkg_checksum) { 'd6832398e3bc9156a660745f427dc1c2392ce4e9a872e04f41f62d0c6bae07a8' } let(:pkg_path) { 'https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe' } let(:pkg_checksum) { nil } - let(:pkg_version) { '8.0.59193' } let(:pkg_type) { :custom } let(:pkg_options) { "/Q" } @@ -57,6 +57,7 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do context "installing additional version" do let(:pkg_path) { 'https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe' } + let(:pkg_checksum) { 'eb00f891919d4f894ab725b158459db8834470c382dc60cd3c3ee2c6de6da92c' } let(:pkg_version) { '8.0.56336' } it "installs older version" do @@ -127,11 +128,6 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do let(:pkg_path) { 'http://iweb.dl.sourceforge.net/project/ultradefrag/stable-release/6.1.1/ultradefrag-6.1.1.bin.amd64.exe' } let(:pkg_checksum) { '11d53ed4c426c8c867ad43f142b7904226ffd9938c02e37086913620d79e3c09' } - it "finds the correct package version" do - subject.run_action(:install) - expect(subject.version).to eq('6.1.1') - end - it "finds the correct installer type" do subject.run_action(:install) expect(subject.provider_for_action(:install).installer_type).to eq(:nsis) @@ -143,11 +139,6 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do let(:pkg_path) { 'http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe' } let(:pkg_checksum) { 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d' } - it "finds the correct package version" do - subject.run_action(:install) - expect(subject.version).to eq(nil) # Mercurial does not include versioning - end - it "finds the correct installer type" do subject.run_action(:install) expect(subject.provider_for_action(:install).installer_type).to eq(:inno) diff --git a/spec/unit/provider/package/windows/exe_spec.rb b/spec/unit/provider/package/windows/exe_spec.rb index 730df5e067..677ab87f29 100644 --- a/spec/unit/provider/package/windows/exe_spec.rb +++ b/spec/unit/provider/package/windows/exe_spec.rb @@ -53,12 +53,8 @@ describe Chef::Provider::Package::Windows::Exe do entries end let(:provider) { Chef::Provider::Package::Windows::Exe.new(new_resource, :nsis, uninstall_entry) } - let(:file_version) { nil } - let(:product_version) { nil } - let(:version_info) { instance_double("Chef::ReservedNames::Win32::File::Version_info", FileVersion: file_version, ProductVersion: product_version) } before(:each) do - allow(Chef::ReservedNames::Win32::File).to receive(:version_info).and_return(version_info) allow(::File).to receive(:exist?).with(Chef::Util::PathHelper.canonical_path(resource_source, false)).and_return(true) end @@ -103,73 +99,13 @@ describe Chef::Provider::Package::Windows::Exe do end end - context "file version is empty" do - let(:file_version) { '' } - - it "returns nil" do - expect(provider.package_version).to eql(nil) - end - - it "returns the version of a package if given" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') - end - end - - context "both file and product version are in installer" do - let(:file_version) { '1.1.1' } - let(:product_version) { '1.1' } - - it "returns the file version" do - expect(provider.package_version).to eql('1.1.1') - end - - it "returns the version of a package if given" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') - end - end - - context "only file version is in installer" do - let(:file_version) { '1.1.1' } - - it "returns the file version" do - expect(provider.package_version).to eql('1.1.1') - end - - it "returns the version of a package if given" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') - end + it "returns the version attribute if given" do + new_resource.version('v55555') + expect(provider.package_version).to eql('v55555') end - context "only product version is in installer" do - let(:product_version) { '1.1' } - - it "returns the product version" do - expect(provider.package_version).to eql('1.1') - end - - it "returns the version of a package if given" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') - end - end - - context "no version info is in installer" do - let(:file_version) { nil } - let(:product_version) { nil } - - it "returns the version of a package" do - new_resource.version('v55555') - expect(provider.package_version).to eql('v55555') - end - end - - context "no version info is in installer and none in attribute" do - it "returns the version of a package" do - expect(provider.package_version).to eql(nil) - end + it "returns nil if no version given" do + expect(provider.package_version).to eql(nil) end end |