Skip to content

Commit

Permalink
(maint) Remove remaining version_is_less mocks
Browse files Browse the repository at this point in the history
For consistency, removed the rest of the version_is_less mocks.

In the three cases where this had an impact on the specs, replaced
them with a concrete version setting on the test host object.
  • Loading branch information
jpartlow committed May 26, 2016
1 parent d3e09cc commit 7ea8fbc
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions spec/beaker-pe/install/pe_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,22 @@ def logger
end

it 'generates a unix PE frictionless install command for a unix host with role "frictionless"' do
allow( subject ).to receive( :version_is_less ).and_return( false )
allow( subject ).to receive( :master ).and_return( 'testmaster' )
the_host = unixhost.dup
the_host['pe_ver'] = '3.8.0'
the_host['pe_installer'] = 'puppet-enterprise-installer'
the_host['roles'] = ['frictionless']
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.0/install.bash && bash install.bash"
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.8.0/install.bash && bash install.bash"
end

it 'generates a unix PE frictionless install command for a unix host with role "frictionless" and "frictionless_options"' do
allow( subject ).to receive( :version_is_less ).and_return( false )
allow( subject ).to receive( :master ).and_return( 'testmaster' )
the_host = unixhost.dup
the_host['pe_ver'] = '3.8.0'
the_host['pe_installer'] = 'puppet-enterprise-installer'
the_host['roles'] = ['frictionless']
the_host['frictionless_options'] = { 'main' => { 'dns_alt_names' => 'puppet' } }
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.0/install.bash && bash install.bash main:dns_alt_names=puppet"
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.8.0/install.bash && bash install.bash main:dns_alt_names=puppet"
end

it 'generates a osx PE install command for a osx host' do
Expand Down Expand Up @@ -243,13 +243,13 @@ def logger
end

it 'generates a unix PE frictionless install command in verbose for a unix host with role "frictionless" and pe_debug is enabled' do
allow( subject ).to receive( :version_is_less ).and_return( false )
allow( subject ).to receive( :master ).and_return( 'testmaster' )
the_host = unixhost.dup
the_host['pe_ver'] = '3.8.0'
the_host['pe_installer'] = 'puppet-enterprise-installer'
the_host['roles'] = ['frictionless']
the_host[:pe_debug] = true
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.0/install.bash && bash -x install.bash"
expect( subject.installer_cmd( the_host, {} ) ).to be === "cd /tmp && curl --tlsv1 -kO https://testmaster:8140/packages/3.8.0/install.bash && bash -x install.bash"
end

end
Expand Down Expand Up @@ -386,7 +386,6 @@ def logger

expect( subject).to_not receive(:scp_to)
expect( subject).to_not receive(:on)
allow( subject ).to receive(:version_is_less).with('3.2.0', '3.2.0').and_return(false)
subject.fetch_pe( [unixhost], {} )
end
end
Expand Down Expand Up @@ -762,8 +761,6 @@ def logger
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
allow( subject ).to receive( :hosts ).and_return( the_hosts )
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
allow( subject ).to receive( :version_is_less ).with('2.8', '3.0').and_return( true )
version = version_win = '2.8'
path = "/path/to/upgradepkg"
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
Expand All @@ -779,8 +776,6 @@ def logger
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
allow( subject ).to receive( :hosts ).and_return( the_hosts )
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
allow( subject ).to receive( :version_is_less ).with('3.1', '3.0').and_return( false )
version = version_win = '3.1'
path = "/path/to/upgradepkg"
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
Expand All @@ -796,8 +791,6 @@ def logger
the_hosts = [ hosts[0].dup, hosts[1].dup, hosts[2].dup ]
allow( subject ).to receive( :hosts ).and_return( the_hosts )
allow( subject ).to receive( :options ).and_return( {} )
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
allow( subject ).to receive( :version_is_less ).with('2.8', '3.0').and_return( true )
version = version_win = '2.8'
path = "/path/to/upgradepkg"
expect( subject ).to receive( :do_install ).with( the_hosts, {:type=>:upgrade, :set_console_password=>true} )
Expand All @@ -811,8 +804,6 @@ def logger
allow( Beaker::Options::PEVersionScraper ).to receive( :load_pe_version ).and_return( '3.1' )
allow( Beaker::Options::PEVersionScraper ).to receive( :load_pe_version_win ).and_return( '3.1' )
allow( subject ).to receive( :hosts ).and_return( hosts )
allow( subject ).to receive( :version_is_less ).with('3.0', '3.4.0').and_return( true )
allow( subject ).to receive( :version_is_less ).with('3.1', '3.0').and_return( false )
allow( subject ).to receive( :sorted_hosts ).and_return( [hosts[0]] )
version = version_win = '3.1'
path = "/path/to/upgradepkg"
Expand Down

0 comments on commit 7ea8fbc

Please sign in to comment.