Skip to content

Commit

Permalink
Merge pull request #174 from cthorn42/maint/master/fix_up_specs_for_r…
Browse files Browse the repository at this point in the history
…uby_3

(maint) Update specs to fix ruby 3 spec failures
  • Loading branch information
joshcooper authored Feb 18, 2022
2 parents 3f94e94 + 18ea959 commit 21d055f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions spec/beaker-puppet/helpers/puppet_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def logger

expect( subject ).to receive( :on ).
with( agent, 'puppet_command',
:acceptable_exit_codes => [0] )
{:acceptable_exit_codes => [0]} )

subject.apply_manifest_on( agent, 'class { "boo": }')
end
Expand All @@ -189,7 +189,7 @@ def logger
and_return( 'puppet_command' )

expect( subject ).to receive( :on ).
with( host, 'puppet_command', :acceptable_exit_codes => [0] )
with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
end

result = subject.apply_manifest_on( the_hosts, 'include foobar' )
Expand All @@ -209,7 +209,7 @@ def logger
and_return( 'puppet_command' )
the_hosts.each do |host|
allow( subject ).to receive( :on ).
with( host, 'puppet_command', :acceptable_exit_codes => [0] )
with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
end

result = nil
Expand All @@ -228,11 +228,11 @@ def logger
and_return( 'puppet_command' )
the_hosts.each do |host|
allow( subject ).to receive( :on ).
with( host, 'puppet_command', :acceptable_exit_codes => [0] )
with( host, 'puppet_command', {:acceptable_exit_codes => [0]} )
end
expect( subject ).to receive( :block_on ).with(
anything,
:run_in_parallel => true
{:run_in_parallel => true}
)

subject.apply_manifest_on( the_hosts, 'include foobar', { :run_in_parallel => true } )
Expand All @@ -246,11 +246,11 @@ def logger

expect( subject ).to receive( :on ).
with( agent, 'puppet_command',
:acceptable_exit_codes => [0,2] )
{:acceptable_exit_codes => [0,2]} )

subject.apply_manifest_on( agent,
'class { "boo": }',
:catch_failures => true )
{:catch_failures => true} )
end
it 'allows acceptable exit codes through :catch_failures' do
allow( subject ).to receive( :hosts ).and_return( hosts )
Expand All @@ -260,12 +260,12 @@ def logger

expect( subject ).to receive( :on ).
with( agent, 'puppet_command',
:acceptable_exit_codes => [4,0,2] )
{:acceptable_exit_codes => [4,0,2]} )

subject.apply_manifest_on( agent,
'class { "boo": }',
:acceptable_exit_codes => [4],
:catch_failures => true )
{:acceptable_exit_codes => [4],
:catch_failures => true} )
end
it 'enforces a 0 exit code through :catch_changes' do
allow( subject ).to receive( :hosts ).and_return( hosts )
Expand All @@ -276,13 +276,13 @@ def logger
expect( subject ).to receive( :on ).with(
agent,
'puppet_command',
:acceptable_exit_codes => [0]
{:acceptable_exit_codes => [0]}
)

subject.apply_manifest_on(
agent,
'class { "boo": }',
:catch_changes => true
{:catch_changes => true}
)
end
it 'enforces a 2 exit code through :expect_changes' do
Expand All @@ -294,13 +294,13 @@ def logger
expect( subject ).to receive( :on ).with(
agent,
'puppet_command',
:acceptable_exit_codes => [2]
{:acceptable_exit_codes => [2]}
)

subject.apply_manifest_on(
agent,
'class { "boo": }',
:expect_changes => true
{:expect_changes => true}
)
end
it 'enforces exit codes through :expect_failures' do
Expand All @@ -312,13 +312,13 @@ def logger
expect( subject ).to receive( :on ).with(
agent,
'puppet_command',
:acceptable_exit_codes => [1,4,6]
{:acceptable_exit_codes => [1,4,6]}
)

subject.apply_manifest_on(
agent,
'class { "boo": }',
:expect_failures => true
{:expect_failures => true}
)
end
it 'enforces exit codes through :expect_failures' do
Expand All @@ -341,14 +341,14 @@ def logger
expect( subject ).to receive( :on ).with(
agent,
'puppet_command',
:acceptable_exit_codes => [1,2,3,4,5,6]
{:acceptable_exit_codes => [1,2,3,4,5,6]}
)

subject.apply_manifest_on(
agent,
'class { "boo": }',
:acceptable_exit_codes => (1..5),
:expect_failures => true
{:acceptable_exit_codes => (1..5),
:expect_failures => true}
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/beaker-puppet/install_utils/windows_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def expect_puppet_path_called(times = 1)
expect_version_log_called
expect( subject ).to receive( :create_install_msi_batch_on ).with(
anything, anything,
'PUPPET_AGENT_STARTUP_MODE' => 'Manual')
{'PUPPET_AGENT_STARTUP_MODE' => 'Manual'})
subject.install_msi_on(hosts, msi_path, {})
end

Expand All @@ -112,7 +112,7 @@ def expect_puppet_path_called(times = 1)
value = 'Automatic'
expect( subject ).to receive( :create_install_msi_batch_on ).with(
anything, anything,
'PUPPET_AGENT_STARTUP_MODE' => value)
{'PUPPET_AGENT_STARTUP_MODE' => value})
subject.install_msi_on(hosts, msi_path, {'PUPPET_AGENT_STARTUP_MODE' => value})
end

Expand Down

0 comments on commit 21d055f

Please sign in to comment.