beaker 3.37.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -1
  3. data/acceptance/lib/helpers/test_helper.rb +0 -28
  4. data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -1
  5. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
  6. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +106 -103
  7. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
  8. data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +1 -50
  9. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
  10. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +71 -27
  11. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +3 -3
  12. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -3
  13. data/acceptance/tests/base/host/file_test.rb +81 -0
  14. data/beaker.gemspec +6 -14
  15. data/docs/how_to/install_puppet.md +2 -0
  16. data/docs/how_to/the_beaker_dsl.md +150 -150
  17. data/docs/how_to/upgrade_from_3_to_4.md +52 -0
  18. data/lib/beaker.rb +0 -10
  19. data/lib/beaker/dsl.rb +7 -0
  20. data/lib/beaker/dsl/helpers.rb +4 -6
  21. data/lib/beaker/dsl/helpers/host_helpers.rb +10 -34
  22. data/lib/beaker/dsl/install_utils.rb +0 -5
  23. data/lib/beaker/dsl/roles.rb +1 -1
  24. data/lib/beaker/host.rb +12 -11
  25. data/lib/beaker/host/aix/file.rb +2 -2
  26. data/lib/beaker/host/aix/group.rb +1 -0
  27. data/lib/beaker/host/aix/user.rb +1 -0
  28. data/lib/beaker/host/freebsd/pkg.rb +9 -0
  29. data/lib/beaker/host/mac/group.rb +1 -0
  30. data/lib/beaker/host/mac/user.rb +8 -13
  31. data/lib/beaker/host/pswindows/file.rb +2 -2
  32. data/lib/beaker/host/pswindows/group.rb +1 -0
  33. data/lib/beaker/host/pswindows/user.rb +1 -0
  34. data/lib/beaker/host/unix/exec.rb +5 -5
  35. data/lib/beaker/host/unix/file.rb +43 -2
  36. data/lib/beaker/host/unix/group.rb +1 -0
  37. data/lib/beaker/host/unix/user.rb +1 -0
  38. data/lib/beaker/host/windows/file.rb +32 -2
  39. data/lib/beaker/host/windows/group.rb +1 -0
  40. data/lib/beaker/host/windows/user.rb +1 -0
  41. data/lib/beaker/host_prebuilt_steps.rb +0 -4
  42. data/lib/beaker/hypervisor.rb +1 -5
  43. data/lib/beaker/result.rb +4 -0
  44. data/lib/beaker/version.rb +1 -1
  45. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +14 -51
  46. data/spec/beaker/dsl/wrappers_spec.rb +0 -46
  47. data/spec/beaker/host/mac/user_spec.rb +5 -8
  48. data/spec/beaker/host/unix/exec_spec.rb +1 -1
  49. data/spec/beaker/host/unix/file_spec.rb +39 -0
  50. data/spec/beaker/host/windows/file_spec.rb +55 -0
  51. data/spec/beaker/host_prebuilt_steps_spec.rb +16 -67
  52. data/spec/beaker/host_spec.rb +10 -14
  53. data/spec/beaker/hypervisor/hypervisor_spec.rb +1 -1
  54. metadata +47 -165
  55. data/acceptance/lib/beaker/acceptance/install_utils.rb +0 -58
  56. data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +0 -68
  57. data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +0 -49
  58. data/lib/beaker/dsl/helpers/facter_helpers.rb +0 -57
  59. data/lib/beaker/dsl/install_utils/pe_defaults.rb +0 -143
  60. data/lib/beaker/dsl/install_utils/windows_utils.rb +0 -223
  61. data/spec/beaker/dsl/ezbake_utils_spec.rb +0 -279
  62. data/spec/beaker/dsl/install_utils/pe_defaults_spec.rb +0 -61
  63. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +0 -263
@@ -19,6 +19,7 @@ module Unix::Group
19
19
  fail_test "failed to get group #{name}" unless result.stdout =~ /^#{name}:.*:[0-9]+:/
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -19,6 +19,7 @@ module Unix::User
19
19
  fail_test "failed to get user #{name}" unless result.stdout =~ /^#{name}:/
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -1,11 +1,11 @@
1
1
  module Windows::File
2
2
  include Beaker::CommandFactory
3
3
 
4
- def tmpfile(name)
4
+ def tmpfile(name = '')
5
5
  execute("cygpath -m $(mktemp -t #{name}.XXXXXX)")
6
6
  end
7
7
 
8
- def tmpdir(name)
8
+ def tmpdir(name = '')
9
9
  execute("cygpath -m $(mktemp -td #{name}.XXXXXX)")
10
10
  end
11
11
 
@@ -15,6 +15,36 @@ module Windows::File
15
15
  tmp_path.gsub(/\n/, '') + '\\TEMP'
16
16
  end
17
17
 
18
+ # (see {Beaker::Host::Unix::File#chown})
19
+ # @note Cygwin's `chown` implementation does not support
20
+ # windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style.
21
+ # This method simply wraps the normal Host#chown call with
22
+ # a call to cygpath to sanitize input.
23
+ def chown(user, path, recursive=false)
24
+ cygpath = execute("cygpath -u #{path}")
25
+ super(user, cygpath, recursive)
26
+ end
27
+
28
+ # (see {Beaker::Host::Unix::File#chgrp})
29
+ # @note Cygwin's `chgrp` implementation does not support
30
+ # windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style.
31
+ # This method simply wraps the normal Host#chgrp call with
32
+ # a call to cygpath to sanitize input.
33
+ def chgrp(group, path, recursive=false)
34
+ cygpath = execute("cygpath -u #{path}")
35
+ super(group, cygpath, recursive)
36
+ end
37
+
38
+ # (see {Beaker::Host::Unix::File#ls_ld})
39
+ # @note Cygwin's `ls_ld` implementation does not support
40
+ # windows-, DOS-, or mixed-style paths, only UNIX/POSIX-style.
41
+ # This method simply wraps the normal Host#ls_ld call with
42
+ # a call to cygpath to sanitize input.
43
+ def ls_ld(path)
44
+ cygpath = execute("cygpath -u #{path}")
45
+ super(cygpath)
46
+ end
47
+
18
48
  # Updates a file path for use with SCP, depending on the SSH Server
19
49
  #
20
50
  # @note This will fail with an SSH server that is not OpenSSL or BitVise.
@@ -19,6 +19,7 @@ module Windows::Group
19
19
  fail_test "failed to get group #{name}" if result.exit_code != 0
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -19,6 +19,7 @@ module Windows::User
19
19
  fail_test "failed to get user #{name}" if result.exit_code != 0
20
20
 
21
21
  yield result if block_given?
22
+ result
22
23
  end
23
24
  end
24
25
 
@@ -573,10 +573,6 @@ module Beaker
573
573
  logger.debug(skip_msg)
574
574
  end
575
575
 
576
- # REMOVE POST BEAKER 3: backwards compatability, do some setup based upon the global type
577
- # this is the worst and i hate it
578
- Class.new.extend(Beaker::DSL).configure_type_defaults_on(host)
579
-
580
576
  if skip_msg.nil?
581
577
  #close the host to re-establish the connection with the new sshd settings
582
578
  host.close
@@ -28,11 +28,7 @@ module Beaker
28
28
  Beaker::Hypervisor
29
29
  else
30
30
  # Custom hypervisor
31
- begin
32
- require "beaker/hypervisor/#{type}"
33
- rescue LoadError
34
- raise "Invalid hypervisor: #{type}"
35
- end
31
+ require "beaker/hypervisor/#{type}"
36
32
  Beaker.const_get(type.split('_').collect(&:capitalize).join)
37
33
  end
38
34
 
@@ -47,6 +47,10 @@ module Beaker
47
47
  def exit_code_in?(range)
48
48
  range.include?(@exit_code)
49
49
  end
50
+
51
+ def success?
52
+ exit_code == 0
53
+ end
50
54
  end
51
55
 
52
56
  class NullResult < Result
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '3.37.0'
3
+ STRING = '4.0.0'
4
4
  end
5
5
  end
@@ -352,57 +352,6 @@ describe ClassMixedWithDSLHelpers do
352
352
  end
353
353
  end
354
354
 
355
- describe '#create_tmpdir_on' do
356
- let(:host) { {'user' => 'puppet'} }
357
- let(:result) { double.as_null_object }
358
-
359
- before :each do
360
- allow(host).to receive(:result).and_return(result)
361
- allow(result).to receive(:exit_code).and_return(0)
362
- allow(result).to receive(:stdout).and_return('puppet')
363
- end
364
-
365
- context 'with no user argument' do
366
-
367
- context 'with no path name argument' do
368
- it 'executes chown once' do
369
- expect(subject).to receive(:on).with(host, /^getent passwd puppet/).and_return(result)
370
- expect(host).to receive(:tmpdir).with(/\/tmp\/beaker.*/)
371
- expect(subject).to receive(:on).with(host, /chown puppet.puppet.*/)
372
- subject.create_tmpdir_on(host, '/tmp/beaker')
373
- end
374
- end
375
-
376
- context 'with path name argument' do
377
- it 'executes chown once' do
378
- expect(subject).to receive(:on).with(host, /^getent passwd puppet/).and_return(result)
379
- expect(host).to receive(:tmpdir).with(/\/tmp\/bogus.*/).and_return("/tmp/bogus")
380
- expect(subject).to receive(:on).with(host, /chown puppet.puppet \/tmp\/bogus.*/)
381
- subject.create_tmpdir_on(host, "/tmp/bogus")
382
- end
383
- end
384
- end
385
-
386
- context 'with an valid user argument' do
387
- it 'executes chown once' do
388
- expect(subject).to receive(:on).with(host, /^getent passwd curiousgeorge/).and_return(result)
389
- expect(host).to receive(:tmpdir).with(/\/tmp\/bogus.*/).and_return("/tmp/bogus")
390
- expect(subject).to receive(:on).with(host, /chown curiousgeorge.curiousgeorge \/tmp\/bogus.*/)
391
- subject.create_tmpdir_on(host, "/tmp/bogus", "curiousgeorge")
392
- end
393
- end
394
-
395
- context 'with a invalid user argument' do
396
- it 'executes chown once' do
397
- allow(result).to receive(:exit_code).and_return(1)
398
- expect(subject).to receive(:on).with(host, /^getent passwd curiousgeorge/).and_return(result)
399
- expect{
400
- subject.create_tmpdir_on(host, "/tmp/bogus", "curiousgeorge")
401
- }.to raise_error(RuntimeError, /User curiousgeorge does not exist on/)
402
- end
403
- end
404
- end
405
-
406
355
  describe '#run_script_on' do
407
356
  it 'scps the script to a tmpdir and executes it on host(s)' do
408
357
  expect( subject ).to receive( :scp_to )
@@ -420,4 +369,18 @@ describe ClassMixedWithDSLHelpers do
420
369
  subject.run_script( '/tmp/test.sh' )
421
370
  end
422
371
  end
372
+
373
+ describe '#install_package' do
374
+ it 'delegates to Host#install_package with arguments on the passed Host' do
375
+ expect( host ).to receive( :install_package ).with( 'pkg_name', '', '1.2.3' )
376
+ subject.install_package( host, 'pkg_name', '1.2.3' )
377
+ end
378
+ end
379
+
380
+ describe '#uninstall_package' do
381
+ it 'delegates to Host#uninstall_package on the passed Host' do
382
+ expect( host ).to receive( :uninstall_package ).with( 'pkg_name' )
383
+ subject.uninstall_package( host, 'pkg_name' )
384
+ end
385
+ end
423
386
  end
@@ -5,43 +5,6 @@ class ClassMixedWithDSLWrappers
5
5
  end
6
6
 
7
7
  describe ClassMixedWithDSLWrappers do
8
- let(:opts) { {'ENV' => { :HOME => "/"}, :cmdexe => true } }
9
- let(:empty_opts) { {'ENV' => {}, :cmdexe => true } }
10
-
11
- describe '#facter' do
12
- it 'should split out the options and pass "facter" as first arg to Command' do
13
- expect( Beaker::Command ).to receive( :new ).
14
- with('facter', [ '-p' ], empty_opts)
15
- subject.facter( '-p' )
16
- end
17
- end
18
-
19
- describe '#cfacter' do
20
- it 'should split out the options and pass "cfacter" as first arg to Command' do
21
- expect( Beaker::Command ).to receive( :new ).
22
- with('cfacter', [ '-p' ], empty_opts)
23
- subject.cfacter( '-p' )
24
- end
25
- end
26
-
27
- describe '#hiera' do
28
- it 'should split out the options and pass "hiera" as first arg to Command' do
29
- expect( Beaker::Command ).to receive( :new ).
30
- with('hiera', [ '-p' ], empty_opts)
31
- subject.hiera( '-p' )
32
- end
33
- end
34
-
35
- describe '#puppet' do
36
- it 'should split out the options and pass "puppet <blank>" to Command' do
37
- merged_opts = opts
38
- merged_opts[:server] = 'master'
39
- expect( Beaker::Command ).to receive( :new ).
40
- with('puppet agent', [ '-tv' ], merged_opts)
41
- subject.puppet( 'agent', '-tv', :server => 'master', 'ENV' => {:HOME => '/'})
42
- end
43
- end
44
-
45
8
  describe '#host_command' do
46
9
  it 'delegates to HostCommand.new' do
47
10
  expect( Beaker::HostCommand ).to receive( :new ).with( 'blah' )
@@ -49,15 +12,6 @@ describe ClassMixedWithDSLWrappers do
49
12
  end
50
13
  end
51
14
 
52
- describe 'deprecated puppet wrappers' do
53
- %w( resource doc kick cert apply master agent filebucket ).each do |sub|
54
- it "#{sub} delegates the proper info to #puppet" do
55
- expect( subject ).to receive( :puppet ).with( sub, 'blah' )
56
- subject.send( "puppet_#{sub}", 'blah')
57
- end
58
- end
59
- end
60
-
61
15
  describe '#powershell' do
62
16
  it 'should pass "powershell.exe <args> -Command <command>" to Command' do
63
17
  command = subject.powershell("Set-Content -path 'fu.txt' -value 'fu'")
@@ -32,6 +32,9 @@ EOS
32
32
  #{puppet2}
33
33
  EOS
34
34
  end
35
+ let( :etc_passwd_line ) do
36
+ "puppet1:*:67:234::0:0:puppet1:/Users/puppet1:/bin/sh"
37
+ end
35
38
  let( :command ) { 'ls' }
36
39
  let( :host ) { double.as_null_object }
37
40
  let( :result ) { Beaker::Result.new( host, command ) }
@@ -63,17 +66,11 @@ EOS
63
66
  expect { subject.user_get(user_name) }.to raise_error(MiniTest::Assertion, "failed to get user #{user_name}")
64
67
  end
65
68
 
66
- it 'parses mac dscacheutil output into /etc/passwd format correctly' do
67
- result.stdout = puppet1
68
- expect( subject ).to receive( :execute ).and_yield(result)
69
- expect( subject.user_get('puppet1') ).to be === "puppet1:*:67:234:puppet1:/Users/puppet1:/bin/bash"
70
- end
71
-
72
69
  it 'yields correctly with the result object' do
73
- result.stdout = puppet1
70
+ result.stdout = etc_passwd_line
74
71
  expect( subject ).to receive( :execute ).and_yield(result)
75
72
  subject.user_get('puppet1') do |result|
76
- expect( result.stdout ).to be === puppet1
73
+ expect( result.stdout ).to be === etc_passwd_line
77
74
  end
78
75
  end
79
76
 
@@ -82,7 +82,7 @@ module Beaker
82
82
  it "calls the correct commands for #{platform}" do
83
83
  opts['platform'] = platform
84
84
  expect(instance).to receive(:exec).twice
85
- expect(instance).to receive(:create_tmpdir_on).and_return(directory)
85
+ expect(instance).to receive(:tmpdir).and_return(directory)
86
86
  expect(Beaker::Command).to receive(:new).with(ssh_move)
87
87
  expect(Beaker::Command).to receive(:new).with(ssh_command)
88
88
  expect(instance).to receive(:ssh_service_restart)
@@ -165,5 +165,44 @@ module Beaker
165
165
  expect( text ).to match( /basedir\=default/ )
166
166
  end
167
167
  end
168
+
169
+ describe '#chown' do
170
+ let (:user) { 'someuser' }
171
+ let (:path) { '/path/to/chown/on' }
172
+
173
+ it 'calls the system method' do
174
+ expect( instance ).to receive( :execute ).with( "chown #{user} #{path}" ).and_return( 0 )
175
+ expect( instance.chown( user, path ) ).to be === 0
176
+ end
177
+
178
+ it 'passes -R if recursive' do
179
+ expect( instance ).to receive( :execute ).with( "chown \-R #{user} #{path}" )
180
+ instance.chown( user, path, true )
181
+ end
182
+ end
183
+
184
+ describe '#chgrp' do
185
+ let (:group) { 'somegroup' }
186
+ let (:path) { '/path/to/chgrp/on' }
187
+
188
+ it 'calls the system method' do
189
+ expect( instance ).to receive( :execute ).with( "chgrp #{group} #{path}" ).and_return( 0 )
190
+ expect( instance.chgrp( group, path ) ).to be === 0
191
+ end
192
+
193
+ it 'passes -R if recursive' do
194
+ expect( instance ).to receive( :execute ).with( "chgrp \-R #{group} #{path}" )
195
+ instance.chgrp( group, path, true )
196
+ end
197
+ end
198
+
199
+ describe '#ls_ld' do
200
+ let (:path) { '/path/to/ls_ld' }
201
+
202
+ it 'calls the system method' do
203
+ expect( instance ).to receive( :execute ).with( "ls -ld #{path}" ).and_return( 0 )
204
+ expect( instance.ls_ld( path ) ).to be === 0
205
+ end
206
+ end
168
207
  end
169
208
  end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Windows::File do
5
+ let (:user) { 'someuser' }
6
+ let (:group) { 'somegroup' }
7
+ let (:path) { 'C:\Foo\Bar' }
8
+ let (:newpath) { '/Foo/Bar' }
9
+ let(:host) { make_host( 'name', { :platform => 'windows' } ) }
10
+
11
+
12
+ describe '#chown' do
13
+ it 'calls cygpath first' do
14
+ expect( host ).to receive( :execute ).with( "cygpath -u #{path}" )
15
+ expect( host ).to receive( :execute ).with( /chown/ )
16
+
17
+ host.chown( user, path )
18
+ end
19
+
20
+ it 'passes cleaned path to super' do
21
+ allow_any_instance_of( Windows::Host ).to receive( :execute ).with( /cygpath/ ).and_return( newpath )
22
+ expect_any_instance_of( Unix::Host ).to receive( :chown ).with( user, newpath , true)
23
+
24
+ host.chown( user, path, true )
25
+ end
26
+ end
27
+
28
+ describe '#chgrp' do
29
+ it 'calls cygpath first' do
30
+ expect( host ).to receive( :execute ).with( "cygpath -u #{path}" ).and_return( path )
31
+ expect( host ).to receive( :execute ).with( "chgrp #{group} #{path}" )
32
+
33
+ host.chgrp( group, path )
34
+ end
35
+
36
+ it 'passes cleaned path to super' do
37
+ allow_any_instance_of( Windows::Host ).to receive( :execute ).with( /cygpath/ ).and_return( newpath )
38
+ expect_any_instance_of( Unix::Host ).to receive( :chgrp ).with( group, newpath , true)
39
+
40
+ host.chgrp( group, path, true )
41
+ end
42
+ end
43
+
44
+ describe '#ls_ld' do
45
+ let(:result) { Beaker::Result.new(host, 'ls') }
46
+
47
+ it 'calls cygpath first' do
48
+ expect( host ).to receive( :execute ).with( "cygpath -u #{path}" ).and_return( path )
49
+ expect( host ).to receive( :execute ).with( "ls -ld #{path}" )
50
+
51
+ host.ls_ld( path )
52
+ end
53
+ end
54
+ end
55
+ end
@@ -598,93 +598,48 @@ describe Beaker do
598
598
  context "set_env" do
599
599
  subject { dummy_class.new }
600
600
 
601
- it "permits user environments on an OS X 10.10 host" do
602
- test_host_ssh_permit_user_environment('osx-10.10')
603
- end
604
-
605
- it "permits user environments on an OS X 10.11 host" do
606
- test_host_ssh_permit_user_environment('osx-10.11')
607
- end
608
-
609
- it "permits user environments on an OS X 10.12 host" do
610
- test_host_ssh_permit_user_environment('osx-10.12')
611
- end
612
-
613
- it "permits user environments on an OS X 10.13 host" do
614
- test_host_ssh_permit_user_environment('osx-10.13')
615
- end
616
-
617
- it "permits user environments on an ssh-based linux host" do
618
- test_host_ssh_permit_user_environment('ubuntu')
619
- end
620
-
621
- it "permits user environments on an sshd-based linux host" do
622
- test_host_ssh_permit_user_environment('eos')
623
- end
624
-
625
- it "permits user environments on an sles host" do
626
- test_host_ssh_permit_user_environment('sles')
627
- end
628
-
629
- it "permits user environments on a solaris host" do
630
- test_host_ssh_permit_user_environment('solaris')
631
- end
632
-
633
- it "permits user environments on an aix host" do
634
- test_host_ssh_permit_user_environment('aix')
635
- end
636
-
637
- it "permits user environments on a FreeBSD host" do
638
- test_host_ssh_permit_user_environment('freebsd')
639
- end
640
-
641
- it "permits user environments on a windows host" do
642
- test_host_ssh_permit_user_environment('windows')
643
- end
644
-
645
-
646
601
  it "sets user ssh environment on an OS X 10.10 host" do
647
- test_host_ssh_set_user_environment('osx-10.10')
602
+ test_host_ssh_calls('osx-10.10')
648
603
  end
649
604
 
650
605
  it "sets user ssh environment on an OS X 10.11 host" do
651
- test_host_ssh_set_user_environment('osx-10.11')
606
+ test_host_ssh_calls('osx-10.11')
652
607
  end
653
608
 
654
609
  it "sets user ssh environment on an OS X 10.12 host" do
655
- test_host_ssh_set_user_environment('osx-10.12')
610
+ test_host_ssh_calls('osx-10.12')
656
611
  end
657
612
 
658
613
  it "sets user ssh environment on an OS X 10.13 host" do
659
- test_host_ssh_set_user_environment('osx-10.13')
614
+ test_host_ssh_calls('osx-10.13')
660
615
  end
661
616
 
662
617
  it "sets user ssh environment on an ssh-based linux host" do
663
- test_host_ssh_set_user_environment('ubuntu')
618
+ test_host_ssh_calls('ubuntu')
664
619
  end
665
620
 
666
621
  it "sets user ssh environment on an sshd-based linux host" do
667
- test_host_ssh_set_user_environment('eos')
622
+ test_host_ssh_calls('eos')
668
623
  end
669
624
 
670
625
  it "sets user ssh environment on an sles host" do
671
- test_host_ssh_set_user_environment('sles')
626
+ test_host_ssh_calls('sles')
672
627
  end
673
628
 
674
629
  it "sets user ssh environment on a solaris host" do
675
- test_host_ssh_set_user_environment('solaris')
630
+ test_host_ssh_calls('solaris')
676
631
  end
677
632
 
678
633
  it "sets user ssh environment on an aix host" do
679
- test_host_ssh_set_user_environment('aix')
634
+ test_host_ssh_calls('aix')
680
635
  end
681
636
 
682
637
  it "sets user ssh environment on a FreeBSD host" do
683
- test_host_ssh_set_user_environment('freebsd')
638
+ test_host_ssh_calls('freebsd')
684
639
  end
685
640
 
686
641
  it "sets user ssh environment on a windows host" do
687
- test_host_ssh_set_user_environment('windows')
642
+ test_host_ssh_calls('windows')
688
643
  end
689
644
 
690
645
  it "skips an f5 host correctly" do
@@ -733,15 +688,7 @@ describe Beaker do
733
688
  subject.set_env(host, options.merge( opts ))
734
689
  end
735
690
 
736
- def test_host_ssh_permit_user_environment(platform_name)
737
- test_host_ssh_calls(platform_name, :ssh_permit_user_environment)
738
- end
739
-
740
- def test_host_ssh_set_user_environment(platform_name)
741
- test_host_ssh_calls(platform_name, :ssh_set_user_environment)
742
- end
743
-
744
- def test_host_ssh_calls(platform_name, method_call_sym)
691
+ def test_host_ssh_calls(platform_name)
745
692
  host = make_host('name', {
746
693
  :platform => platform_name,
747
694
  :ssh_env_file => 'ssh_env_file',
@@ -752,9 +699,11 @@ describe Beaker do
752
699
  :env2_key => :env2_value
753
700
  }
754
701
 
755
- allow( host ).to receive( :skip_set_env? ).and_return(nil )
702
+ allow( host ).to receive( :skip_set_env? ).and_return( nil )
756
703
  expect( subject ).to receive( :construct_env ).and_return( opts )
757
- expect( host ).to receive( method_call_sym )
704
+
705
+ expect( host ).to receive( :ssh_permit_user_environment )
706
+ expect( host ).to receive( :ssh_set_user_environment )
758
707
 
759
708
  subject.set_env(host, options.merge( opts ))
760
709
  end