beaker 4.38.1 → 4.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +12 -0
  3. data/.rubocop.yml +62 -0
  4. data/.rubocop_todo.yml +215 -0
  5. data/CHANGELOG.md +72 -33
  6. data/Gemfile +8 -1
  7. data/HISTORY.md +103 -0
  8. data/Rakefile +10 -9
  9. data/acceptance/fixtures/module/Gemfile +1 -1
  10. data/acceptance/fixtures/module/Rakefile +2 -2
  11. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -11
  12. data/acceptance/fixtures/module/spec/classes/init_spec.rb +1 -1
  13. data/acceptance/lib/helpers/test_helper.rb +3 -3
  14. data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +6 -6
  15. data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +6 -6
  16. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +6 -12
  17. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +4 -4
  18. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +1 -1
  19. data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +7 -7
  20. data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +4 -4
  21. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +4 -4
  22. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +8 -11
  23. data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +2 -2
  24. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +6 -11
  25. data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +5 -9
  26. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +2 -2
  27. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +1 -1
  28. data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +4 -4
  29. data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +1 -1
  30. data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +1 -1
  31. data/acceptance/tests/base/dsl/structure_test.rb +4 -10
  32. data/acceptance/tests/base/host/file_test.rb +7 -7
  33. data/acceptance/tests/base/host/group_test.rb +2 -2
  34. data/acceptance/tests/base/host/host_test.rb +5 -5
  35. data/acceptance/tests/base/host/packages.rb +26 -28
  36. data/acceptance/tests/base/host/packages_unix.rb +4 -4
  37. data/acceptance/tests/base/host/user_test.rb +2 -2
  38. data/acceptance/tests/install/from_file.rb +2 -2
  39. data/beaker.gemspec +9 -9
  40. data/docs/concepts/style_guide.md +1 -1
  41. data/docs/how_to/debug_beaker_tests.md +1 -1
  42. data/docs/how_to/test_arbitrary_beaker_versions.md +2 -2
  43. data/lib/beaker/cli.rb +6 -8
  44. data/lib/beaker/command.rb +3 -3
  45. data/lib/beaker/command_factory.rb +2 -2
  46. data/lib/beaker/dsl/assertions.rb +1 -1
  47. data/lib/beaker/dsl/helpers/hocon_helpers.rb +2 -2
  48. data/lib/beaker/dsl/helpers/host_helpers.rb +11 -11
  49. data/lib/beaker/dsl/helpers/web_helpers.rb +3 -3
  50. data/lib/beaker/dsl/outcomes.rb +4 -4
  51. data/lib/beaker/dsl/roles.rb +2 -2
  52. data/lib/beaker/dsl/structure.rb +10 -10
  53. data/lib/beaker/host/aix/group.rb +3 -3
  54. data/lib/beaker/host/aix/user.rb +3 -3
  55. data/lib/beaker/host/cisco.rb +11 -11
  56. data/lib/beaker/host/eos.rb +2 -2
  57. data/lib/beaker/host/mac/exec.rb +1 -1
  58. data/lib/beaker/host/mac/group.rb +7 -7
  59. data/lib/beaker/host/mac/pkg.rb +6 -6
  60. data/lib/beaker/host/mac/user.rb +6 -6
  61. data/lib/beaker/host/pswindows/exec.rb +8 -8
  62. data/lib/beaker/host/pswindows/file.rb +1 -1
  63. data/lib/beaker/host/pswindows/group.rb +3 -3
  64. data/lib/beaker/host/pswindows/pkg.rb +6 -6
  65. data/lib/beaker/host/pswindows/user.rb +2 -2
  66. data/lib/beaker/host/unix/exec.rb +6 -6
  67. data/lib/beaker/host/unix/file.rb +3 -4
  68. data/lib/beaker/host/unix/group.rb +3 -3
  69. data/lib/beaker/host/unix/pkg.rb +17 -17
  70. data/lib/beaker/host/unix/user.rb +3 -3
  71. data/lib/beaker/host/unix.rb +10 -9
  72. data/lib/beaker/host/windows/exec.rb +3 -3
  73. data/lib/beaker/host/windows/file.rb +2 -2
  74. data/lib/beaker/host/windows/group.rb +3 -3
  75. data/lib/beaker/host/windows/pkg.rb +6 -6
  76. data/lib/beaker/host/windows/user.rb +2 -2
  77. data/lib/beaker/host/windows.rb +2 -2
  78. data/lib/beaker/host.rb +7 -7
  79. data/lib/beaker/host_prebuilt_steps.rb +38 -45
  80. data/lib/beaker/hypervisor.rb +4 -4
  81. data/lib/beaker/local_connection.rb +3 -3
  82. data/lib/beaker/logger.rb +5 -11
  83. data/lib/beaker/logger_junit.rb +2 -2
  84. data/lib/beaker/network_manager.rb +2 -2
  85. data/lib/beaker/options/command_line_parser.rb +1 -1
  86. data/lib/beaker/options/hosts_file_parser.rb +21 -4
  87. data/lib/beaker/options/options_file_parser.rb +1 -1
  88. data/lib/beaker/options/options_hash.rb +1 -3
  89. data/lib/beaker/options/parser.rb +6 -6
  90. data/lib/beaker/options/presets.rb +2 -2
  91. data/lib/beaker/options/validator.rb +2 -2
  92. data/lib/beaker/perf.rb +9 -9
  93. data/lib/beaker/platform.rb +1 -1
  94. data/lib/beaker/shared/host_manager.rb +4 -5
  95. data/lib/beaker/shared/repetition.rb +4 -4
  96. data/lib/beaker/shared/semvar.rb +2 -2
  97. data/lib/beaker/shared/timed.rb +2 -2
  98. data/lib/beaker/ssh_connection.rb +9 -9
  99. data/lib/beaker/subcommand.rb +6 -6
  100. data/lib/beaker/tasks/quick_start.rb +2 -2
  101. data/lib/beaker/tasks/rake_task.rb +3 -3
  102. data/lib/beaker/test_suite.rb +2 -2
  103. data/lib/beaker/test_suite_result.rb +8 -11
  104. data/lib/beaker/version.rb +1 -1
  105. data/spec/beaker/cli_spec.rb +46 -43
  106. data/spec/beaker/command_spec.rb +17 -7
  107. data/spec/beaker/dsl/assertions_spec.rb +2 -11
  108. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +7 -7
  109. data/spec/beaker/dsl/helpers/web_helpers_spec.rb +2 -2
  110. data/spec/beaker/dsl/outcomes_spec.rb +1 -0
  111. data/spec/beaker/dsl/roles_spec.rb +48 -5
  112. data/spec/beaker/dsl/structure_spec.rb +22 -15
  113. data/spec/beaker/dsl/test_tagging_spec.rb +16 -16
  114. data/spec/beaker/dsl/wrappers_spec.rb +7 -7
  115. data/spec/beaker/host/cisco_spec.rb +8 -8
  116. data/spec/beaker/host/freebsd/exec_spec.rb +3 -3
  117. data/spec/beaker/host/freebsd/pkg_spec.rb +6 -3
  118. data/spec/beaker/host/mac/exec_spec.rb +3 -3
  119. data/spec/beaker/host/mac_spec.rb +6 -6
  120. data/spec/beaker/host/pswindows/exec_spec.rb +8 -5
  121. data/spec/beaker/host/pswindows/file_spec.rb +6 -3
  122. data/spec/beaker/host/pswindows_spec.rb +1 -1
  123. data/spec/beaker/host/unix/exec_spec.rb +24 -24
  124. data/spec/beaker/host/unix/file_spec.rb +18 -17
  125. data/spec/beaker/host/unix/pkg_spec.rb +26 -22
  126. data/spec/beaker/host/unix_spec.rb +8 -8
  127. data/spec/beaker/host/windows/exec_spec.rb +4 -4
  128. data/spec/beaker/host/windows/file_spec.rb +4 -4
  129. data/spec/beaker/host/windows/group_spec.rb +12 -12
  130. data/spec/beaker/host/windows/pkg_spec.rb +5 -5
  131. data/spec/beaker/host_prebuilt_steps_spec.rb +26 -20
  132. data/spec/beaker/host_spec.rb +72 -63
  133. data/spec/beaker/hypervisor/hypervisor_spec.rb +14 -14
  134. data/spec/beaker/localhost_connection_spec.rb +6 -4
  135. data/spec/beaker/logger_junit_spec.rb +16 -17
  136. data/spec/beaker/logger_spec.rb +54 -52
  137. data/spec/beaker/network_manager_spec.rb +5 -5
  138. data/spec/beaker/options/command_line_parser_spec.rb +2 -2
  139. data/spec/beaker/options/data/hosts_preserved.yml +395 -0
  140. data/spec/beaker/options/hosts_file_parser_spec.rb +9 -2
  141. data/spec/beaker/options/options_file_parser_spec.rb +1 -1
  142. data/spec/beaker/options/options_hash_spec.rb +4 -4
  143. data/spec/beaker/options/parser_spec.rb +23 -23
  144. data/spec/beaker/options/presets_spec.rb +2 -2
  145. data/spec/beaker/options/subcommand_options_parser_spec.rb +4 -3
  146. data/spec/beaker/options/validator_spec.rb +18 -18
  147. data/spec/beaker/perf_spec.rb +29 -28
  148. data/spec/beaker/platform_spec.rb +3 -2
  149. data/spec/beaker/shared/error_handler_spec.rb +1 -1
  150. data/spec/beaker/shared/fog_credentials_spec.rb +12 -12
  151. data/spec/beaker/shared/host_manager_spec.rb +7 -7
  152. data/spec/beaker/shared/repetition_spec.rb +9 -9
  153. data/spec/beaker/ssh_connection_spec.rb +14 -12
  154. data/spec/beaker/subcommand/subcommand_util_spec.rb +9 -4
  155. data/spec/beaker/subcommand_spec.rb +30 -28
  156. data/spec/beaker/test_case_spec.rb +11 -15
  157. data/spec/beaker/test_suite_spec.rb +24 -24
  158. data/spec/matchers.rb +1 -1
  159. data/spec/mocks.rb +5 -5
  160. data/spec/spec_helper.rb +0 -3
  161. metadata +59 -59
  162. data/spec/mock_fission.rb +0 -60
  163. data/spec/mock_vsphere.rb +0 -314
  164. data/spec/mock_vsphere_helper.rb +0 -183
@@ -24,16 +24,16 @@ module Beaker
24
24
 
25
25
  end
26
26
 
27
- let (:opts) { @opts || {} }
28
- let (:logger) { double( 'logger' ).as_null_object }
29
- let (:platform) {
27
+ let(:opts) { @opts || {} }
28
+ let(:logger) { double( 'logger' ).as_null_object }
29
+ let(:platform) {
30
30
  if @platform
31
31
  { 'platform' => Beaker::Platform.new( @platform) }
32
32
  else
33
33
  { 'platform' => Beaker::Platform.new( 'osx-10.9-x86_64' ) }
34
34
  end
35
35
  }
36
- let (:instance) { UnixFileTest.new(opts.merge(platform), logger) }
36
+ let(:instance) { UnixFileTest.new(opts.merge(platform), logger) }
37
37
 
38
38
  describe '#repo_type' do
39
39
 
@@ -94,7 +94,7 @@ module Beaker
94
94
  ['centos','redhat'].each do |platform|
95
95
  it "sets the el portion correctly for '#{platform}'" do
96
96
  @platform = "#{platform}-5-x86_64"
97
- allow( instance ).to receive( :is_pe? ) { false }
97
+ allow( instance ).to receive( :is_pe? ).and_return(false)
98
98
  filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
99
99
  expect( filename ).to match( /sion7\-el\-/ )
100
100
  end
@@ -102,21 +102,21 @@ module Beaker
102
102
 
103
103
  it 'sets the sles portion correctly for sles platforms' do
104
104
  @platform = 'sles-11-x86_64'
105
- allow( instance ).to receive( :is_pe? ) { false }
105
+ allow( instance ).to receive( :is_pe? ).and_return(false)
106
106
  filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
107
107
  expect( filename ).to match( /sion7\-sles\-/ )
108
108
  end
109
109
 
110
110
  it 'sets the opensuse portion correctly for opensuse platforms' do
111
111
  @platform = 'opensuse-15-x86_64'
112
- allow( instance ).to receive( :is_pe? ) { false }
112
+ allow( instance ).to receive( :is_pe? ).and_return(false)
113
113
  filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
114
114
  expect( filename ).to match( /sion7\-opensuse\-/ )
115
115
  end
116
116
 
117
117
  it 'builds the filename correctly for el-based platforms' do
118
118
  @platform = 'el-21-x86_64'
119
- allow( instance ).to receive( :is_pe? ) { false }
119
+ allow( instance ).to receive( :is_pe? ).and_return(false)
120
120
  filename = instance.repo_filename( 'pkg_name', 'pkg_version8' )
121
121
  correct = 'pl-pkg_name-pkg_version8-el-21-x86_64.repo'
122
122
  expect( filename ).to be === correct
@@ -125,7 +125,7 @@ module Beaker
125
125
  it 'builds the filename correctly for redhatfips platforms' do
126
126
  @platform = 'el-7-x86_64'
127
127
  allow(instance).to receive(:[]).with('platform') { platform['platform'] }
128
- expect(instance).to receive(:[]).with('packaging_platform') { 'redhatfips-7-x86_64' }
128
+ expect(instance).to receive(:[]).with('packaging_platform').and_return('redhatfips-7-x86_64')
129
129
  filename = instance.repo_filename('pkg_name', 'pkg_version')
130
130
  correct = 'pl-pkg_name-pkg_version-redhatfips-7-x86_64.repo'
131
131
  expect( filename ).to be === correct
@@ -133,7 +133,7 @@ module Beaker
133
133
 
134
134
  it 'adds in the PE portion of the filename correctly for el-based PE hosts' do
135
135
  @platform = 'el-21-x86_64'
136
- allow( instance ).to receive( :is_pe? ) { true }
136
+ allow( instance ).to receive( :is_pe? ).and_return(true)
137
137
  filename = instance.repo_filename( 'pkg_name', 'pkg_version9' )
138
138
  correct = 'pl-pkg_name-pkg_version9-el-21-x86_64.repo'
139
139
  expect( filename ).to be === correct
@@ -155,7 +155,7 @@ module Beaker
155
155
 
156
156
  it 'adds wrlinux to variant on cisco platforms' do
157
157
  @platform = 'cisco_nexus-7-x86_64'
158
- allow( instance ).to receive( :is_pe? ) { false }
158
+ allow( instance ).to receive( :is_pe? ).and_return(false)
159
159
  filename = instance.repo_filename( 'pkg_name', 'pkg_version12' )
160
160
  expect( filename ).to match( /sion12\-cisco\-wrlinux\-/ )
161
161
  end
@@ -194,8 +194,8 @@ module Beaker
194
194
  end
195
195
 
196
196
  describe '#chown' do
197
- let (:user) { 'someuser' }
198
- let (:path) { '/path/to/chown/on' }
197
+ let(:user) { 'someuser' }
198
+ let(:path) { '/path/to/chown/on' }
199
199
 
200
200
  it 'calls the system method' do
201
201
  expect( instance ).to receive( :execute ).with( "chown #{user} #{path}" ).and_return( 0 )
@@ -209,7 +209,8 @@ module Beaker
209
209
  end
210
210
 
211
211
  describe '#cat' do
212
- let (:path) { '/path/to/cat/on' }
212
+ let(:path) { '/path/to/cat/on' }
213
+
213
214
  it 'calls cat for path' do
214
215
  expect( instance ).to receive( :execute ).with( "cat #{path}" ).and_return( 0 )
215
216
  expect( instance.cat( path ) ).to be === 0
@@ -239,8 +240,8 @@ module Beaker
239
240
  end
240
241
 
241
242
  describe '#chgrp' do
242
- let (:group) { 'somegroup' }
243
- let (:path) { '/path/to/chgrp/on' }
243
+ let(:group) { 'somegroup' }
244
+ let(:path) { '/path/to/chgrp/on' }
244
245
 
245
246
  it 'calls the system method' do
246
247
  expect( instance ).to receive( :execute ).with( "chgrp #{group} #{path}" ).and_return( 0 )
@@ -254,7 +255,7 @@ module Beaker
254
255
  end
255
256
 
256
257
  describe '#ls_ld' do
257
- let (:path) { '/path/to/ls_ld' }
258
+ let(:path) { '/path/to/ls_ld' }
258
259
 
259
260
  it 'calls the system method' do
260
261
  expect( instance ).to receive( :execute ).with( "ls -ld #{path}" ).and_return( 0 )
@@ -28,9 +28,9 @@ module Beaker
28
28
 
29
29
  end
30
30
 
31
- let (:opts) { @opts || {} }
32
- let (:logger) { double( 'logger' ).as_null_object }
33
- let (:instance) { UnixPkgTest.new(opts, logger) }
31
+ let(:opts) { @opts || {} }
32
+ let(:logger) { double( 'logger' ).as_null_object }
33
+ let(:instance) { UnixPkgTest.new(opts, logger) }
34
34
 
35
35
  context 'Package deployment tests' do
36
36
  path = '/some/file/path'
@@ -41,48 +41,48 @@ module Beaker
41
41
 
42
42
  it 'returns a warning if there is no file at the path specified' do
43
43
  expect(logger).to receive(:warn)
44
- allow(File).to receive(:exists?).with(path).and_return(false)
44
+ allow(File).to receive(:exist?).with(path).and_return(false)
45
45
  instance.deploy_package_repo(path,name,version)
46
46
  end
47
47
 
48
48
  it 'calls #deploy_apt_repo for huaweios systems' do
49
49
  @opts = {'platform' => 'huaweios-is-me'}
50
50
  expect(instance).to receive(:deploy_apt_repo)
51
- allow(File).to receive(:exists?).with(path).and_return(true)
51
+ allow(File).to receive(:exist?).with(path).and_return(true)
52
52
  instance.deploy_package_repo(path,name,version)
53
53
  end
54
54
 
55
55
  it 'calls #deploy_apt_repo for debian systems' do
56
56
  @opts = {'platform' => 'ubuntu-is-me'}
57
57
  expect(instance).to receive(:deploy_apt_repo)
58
- allow(File).to receive(:exists?).with(path).and_return(true)
58
+ allow(File).to receive(:exist?).with(path).and_return(true)
59
59
  instance.deploy_package_repo(path,name,version)
60
60
  end
61
61
 
62
62
  it 'calls #deploy_yum_repo for el systems' do
63
63
  @opts = {'platform' => 'el-is-me'}
64
64
  expect(instance).to receive(:deploy_yum_repo)
65
- allow(File).to receive(:exists?).with(path).and_return(true)
65
+ allow(File).to receive(:exist?).with(path).and_return(true)
66
66
  instance.deploy_package_repo(path,name,version)
67
67
  end
68
68
 
69
69
  it 'calls #deploy_zyp_repo for sles systems' do
70
70
  @opts = {'platform' => 'sles-is-me'}
71
71
  expect(instance).to receive(:deploy_zyp_repo)
72
- allow(File).to receive(:exists?).with(path).and_return(true)
72
+ allow(File).to receive(:exist?).with(path).and_return(true)
73
73
  instance.deploy_package_repo(path,name,version)
74
74
  end
75
75
 
76
76
  it 'calls #deploy_zyp_repo for opensuse systems' do
77
77
  @opts = {'platform' => 'opensuse-is-me'}
78
78
  expect(instance).to receive(:deploy_zyp_repo)
79
- allow(File).to receive(:exists?).with(path).and_return(true)
79
+ allow(File).to receive(:exist?).with(path).and_return(true)
80
80
  instance.deploy_package_repo(path,name,version)
81
81
  end
82
82
 
83
83
  it 'raises an error for unsupported systems' do
84
84
  @opts = {'platform' => 'windows-is-me'}
85
- allow(File).to receive(:exists?).with(path).and_return(true)
85
+ allow(File).to receive(:exist?).with(path).and_return(true)
86
86
  expect{instance.deploy_package_repo(path,name,version)}.to raise_error(RuntimeError)
87
87
  end
88
88
  end
@@ -94,7 +94,7 @@ module Beaker
94
94
  expect(logger).to receive(:warn)
95
95
  allow(@opts['platform']).to receive(:codename).and_return(nil)
96
96
  expect(instance).to receive(:deploy_apt_repo).and_return(instance.deploy_apt_repo(path,name,version))
97
- allow(File).to receive(:exists?).with(path).and_return(true)
97
+ allow(File).to receive(:exist?).with(path).and_return(true)
98
98
  instance.deploy_package_repo(path,name,version)
99
99
  end
100
100
  end
@@ -106,15 +106,16 @@ module Beaker
106
106
  pkg = 'sles_package'
107
107
  expect( Beaker::Command ).to receive( :new ).with( /^rpmkeys.*nightlies.puppetlabs.com.*/, anything, anything ).and_return('').ordered.once
108
108
  expect( Beaker::Command ).to receive(:new).with("zypper --gpg-auto-import-keys se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('').ordered.once
109
- expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
109
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).twice
110
110
  expect( instance.check_for_package(pkg) ).to be === true
111
111
  end
112
+
112
113
  it "checks correctly on opensuse" do
113
114
  @opts = {'platform' => 'opensuse-is-me'}
114
115
  pkg = 'sles_package'
115
116
  expect( Beaker::Command ).to receive( :new ).with( /^rpmkeys.*nightlies.puppetlabs.com.*/, anything, anything ).and_return('').ordered.once
116
117
  expect( Beaker::Command ).to receive(:new).with("zypper --gpg-auto-import-keys se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('').ordered.once
117
- expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
118
+ expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0})).twice
118
119
  expect( instance.check_for_package(pkg) ).to be === true
119
120
  end
120
121
 
@@ -159,6 +160,7 @@ module Beaker
159
160
  expect( instance ).to receive(:exec).with('', {:accept_all_exit_codes => true}).and_return(generate_result("hello", {:exit_code => 0}))
160
161
  expect( instance.check_for_package(pkg) ).to be === true
161
162
  end
163
+
162
164
  it "checks correctly on debian" do
163
165
  @opts = {'platform' => 'debian-is-me'}
164
166
  pkg = 'debian_package'
@@ -226,12 +228,13 @@ module Beaker
226
228
  PlatformHelpers::DEBIANPLATFORMS.each do |platform|
227
229
  it "calls update for #{platform}" do
228
230
  @opts = {'platform' => platform}
229
- instance.instance_variable_set("@apt_needs_update", true)
231
+ instance.instance_variable_set(:@apt_needs_update, true)
230
232
  expect(instance).to receive('execute').with("apt-get update")
231
- expect{instance.update_apt_if_needed}.to_not raise_error
233
+ expect{instance.update_apt_if_needed}.not_to raise_error
232
234
  end
233
235
  end
234
236
  end
237
+
235
238
  context "install_package" do
236
239
 
237
240
  PlatformHelpers::DEBIANPLATFORMS.each do |platform|
@@ -391,6 +394,7 @@ module Beaker
391
394
  end
392
395
  end
393
396
  end
397
+
394
398
  context "install_package_with_rpm" do
395
399
 
396
400
  it "accepts a package as a single argument" do
@@ -433,9 +437,9 @@ module Beaker
433
437
 
434
438
  end
435
439
 
436
- context '#pe_puppet_agent_promoted_package_install' do
440
+ describe '#pe_puppet_agent_promoted_package_install' do
437
441
  context 'on solaris platforms' do
438
- before :each do
442
+ before do
439
443
  allow( subject ).to receive( :fetch_http_file )
440
444
  allow( subject ).to receive( :scp_to )
441
445
  allow( subject ).to receive( :configure_type_defaults_on )
@@ -477,7 +481,7 @@ module Beaker
477
481
  end
478
482
 
479
483
  context 'on solaris 10' do
480
- before :each do
484
+ before do
481
485
  solaris_platform = Beaker::Platform.new('solaris-10-x86_64')
482
486
  @opts = {'platform' => solaris_platform}
483
487
  end
@@ -505,7 +509,7 @@ module Beaker
505
509
  end
506
510
 
507
511
  context 'on solaris 11' do
508
- before :each do
512
+ before do
509
513
  solaris_platform = Beaker::Platform.new('solaris-11-x86_64')
510
514
  @opts = {'platform' => solaris_platform}
511
515
  end
@@ -526,7 +530,7 @@ module Beaker
526
530
  let( :platform ) { @platform || 'fedora' }
527
531
  let( :version ) { @version || 6 }
528
532
 
529
- before :each do
533
+ before do
530
534
  allow( instance ).to receive( :[] ).with( 'platform' ) { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
531
535
  end
532
536
 
@@ -589,7 +593,7 @@ module Beaker
589
593
  let( :base_dir ) { '/base/dir/fake' }
590
594
  let( :download_file ) { 'download_file.txt' }
591
595
 
592
- before :each do
596
+ before do
593
597
  allow( instance ).to receive( :[] ).with( 'platform' ) { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
594
598
  end
595
599
 
@@ -620,7 +624,7 @@ module Beaker
620
624
 
621
625
  context 'on solaris' do
622
626
 
623
- before :each do
627
+ before do
624
628
  @platform = 'solaris'
625
629
  end
626
630
 
@@ -43,7 +43,7 @@ module Unix
43
43
 
44
44
  it 'sets release_path_end correctly' do
45
45
  @platform = 'solaris-10-arch'
46
- allow( host ).to receive( :link_exists? ) { true }
46
+ allow( host ).to receive( :link_exists? ).and_return(true)
47
47
  release_path_end, _ = host.solaris_puppet_agent_dev_package_info(
48
48
  'pa_collection4', 'pa_version', opts )
49
49
  expect( release_path_end ).to be === "solaris/10/pa_collection4"
@@ -51,7 +51,7 @@ module Unix
51
51
 
52
52
  it 'sets the arch correctly for x86_64 platforms' do
53
53
  @platform = 'solaris-10-x86_64'
54
- allow( host ).to receive( :link_exists? ) { true }
54
+ allow( host ).to receive( :link_exists? ).and_return(true)
55
55
  _, release_file = host.solaris_puppet_agent_dev_package_info(
56
56
  'pa_collection', 'pa_version', opts )
57
57
  expect( release_file ).to match( /i386/ )
@@ -60,7 +60,7 @@ module Unix
60
60
 
61
61
  context 'sets release_file name appropriately for puppet-agent version' do
62
62
  context 'on solaris 10' do
63
- before :each do
63
+ before do
64
64
  @platform = 'solaris-10-arch'
65
65
  end
66
66
 
@@ -75,14 +75,14 @@ module Unix
75
75
 
76
76
  context "#{pa_version}" do
77
77
  it "URL exists" do
78
- allow( host ).to receive( :link_exists? ) { true }
78
+ allow( host ).to receive( :link_exists? ).and_return(true)
79
79
  _, release_file = host.solaris_puppet_agent_dev_package_info(
80
80
  'pa_collection', pa_version, opts )
81
81
  expect( release_file ).to be === "puppet-agent-#{pa_version}-1.arch.pkg.gz"
82
82
  end
83
83
 
84
84
  it "fallback URL" do
85
- allow( host ).to receive( :link_exists? ) { false }
85
+ allow( host ).to receive( :link_exists? ).and_return(false)
86
86
  _, release_file = host.solaris_puppet_agent_dev_package_info(
87
87
  'pa_collection', pa_version, opts )
88
88
  expect( release_file ).to be === "puppet-agent-#{pa_version}.arch.pkg.gz"
@@ -92,7 +92,7 @@ module Unix
92
92
  end
93
93
 
94
94
  context 'on solaris 11' do
95
- before :each do
95
+ before do
96
96
  @platform = 'solaris-11-arch'
97
97
  end
98
98
 
@@ -109,14 +109,14 @@ module Unix
109
109
 
110
110
  context "#{pa_version}" do
111
111
  it "URL exists" do
112
- allow( host ).to receive( :link_exists? ) { true }
112
+ allow( host ).to receive( :link_exists? ).and_return(true)
113
113
  _, release_file = host.solaris_puppet_agent_dev_package_info(
114
114
  'pa_collection', pa_version, opts )
115
115
  expect( release_file ).to be === "puppet-agent@#{pa_version_cleaned},5.11-1.arch.p5p"
116
116
  end
117
117
 
118
118
  it "fallback URL" do
119
- allow( host ).to receive( :link_exists? ) { false }
119
+ allow( host ).to receive( :link_exists? ).and_return(false)
120
120
  _, release_file = host.solaris_puppet_agent_dev_package_info(
121
121
  'pa_collection', pa_version, opts )
122
122
  expect( release_file ).to be === "puppet-agent@#{pa_version_cleaned},5.11.arch.p5p"
@@ -21,9 +21,9 @@ module Beaker
21
21
 
22
22
  end
23
23
 
24
- let (:opts) { @opts || {} }
25
- let (:logger) { double( 'logger' ).as_null_object }
26
- let (:instance) { WindowsExecTest.new(opts, logger) }
24
+ let(:opts) { @opts || {} }
25
+ let(:logger) { double( 'logger' ).as_null_object }
26
+ let(:instance) { WindowsExecTest.new(opts, logger) }
27
27
 
28
28
  describe '#prepend_commands' do
29
29
  it 'sets spacing correctly if both parts are defined' do
@@ -63,7 +63,7 @@ module Beaker
63
63
  end
64
64
 
65
65
  describe '#cygwin_installed?' do
66
- let (:response) { double( 'response' ) }
66
+ let(:response) { double( 'response' ) }
67
67
 
68
68
  it 'uses cygcheck to see if cygwin is installed' do
69
69
  expect( Beaker::Command ).to receive(:new).with("cygcheck --check-setup cygwin").and_return(:foo)
@@ -2,10 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe Windows::File do
5
- let (:user) { 'someuser' }
6
- let (:group) { 'somegroup' }
7
- let (:path) { 'C:\Foo\Bar' }
8
- let (:newpath) { '/Foo/Bar' }
5
+ let(:user) { 'someuser' }
6
+ let(:group) { 'somegroup' }
7
+ let(:path) { 'C:\Foo\Bar' }
8
+ let(:newpath) { '/Foo/Bar' }
9
9
  let(:host) { make_host( 'name', { :platform => 'windows' } ) }
10
10
 
11
11
 
@@ -9,26 +9,26 @@ module Beaker
9
9
  let(:instance) { WindowsGroupTest.new }
10
10
  let(:result) { double(:result, :stdout => group_list_output) }
11
11
  let(:group_list_output) do <<-EOS
12
-
13
-
14
- Name=Foo
15
-
16
-
17
- Name=Bar6
18
-
19
-
12
+
13
+
14
+ Name=Foo
15
+
16
+
17
+ Name=Bar6
18
+
19
+
20
20
  EOS
21
21
  end
22
22
 
23
23
  def add_group(group_name)
24
24
  group_list_output << <<-EOS
25
- Name=#{group_name}
26
-
27
-
25
+ Name=#{group_name}
26
+
27
+
28
28
  EOS
29
29
  end
30
30
 
31
- before(:each) do
31
+ before do
32
32
  expect( instance ).to receive(:execute).with(/wmic group where/).and_yield(result)
33
33
  end
34
34
 
@@ -24,17 +24,17 @@ module Beaker
24
24
 
25
25
  end
26
26
 
27
- let (:opts) { @opts || {} }
28
- let (:logger) { double( 'logger' ).as_null_object }
29
- let (:instance) { WindowsPkgTest.new(opts, logger) }
27
+ let(:opts) { @opts || {} }
28
+ let(:logger) { double( 'logger' ).as_null_object }
29
+ let(:instance) { WindowsPkgTest.new(opts, logger) }
30
30
 
31
31
  describe '#install_package' do
32
- before :each do
32
+ before do
33
33
  allow( instance ).to receive( :identify_windows_architecture )
34
34
  end
35
35
 
36
36
  context 'cygwin does not exist' do
37
- before :each do
37
+ before do
38
38
  allow( instance ).to receive( :check_for_command ).and_return( false )
39
39
  end
40
40
 
@@ -25,6 +25,7 @@ describe Beaker do
25
25
 
26
26
  shared_examples 'enables_root_login' do |platform, commands, non_cygwin|
27
27
  subject { dummy_class.new }
28
+
28
29
  it "can enable root login on #{platform}" do
29
30
  hosts = make_hosts( { :platform => platform, :is_cygwin => non_cygwin} )
30
31
 
@@ -40,61 +41,61 @@ describe Beaker do
40
41
  end
41
42
  end
42
43
 
43
- it_should_behave_like 'enables_root_login', 'f5', []
44
+ it_behaves_like 'enables_root_login', 'f5', []
44
45
  # Non-cygwin Windows
45
- it_should_behave_like 'enables_root_login', 'pswindows', [], false
46
+ it_behaves_like 'enables_root_login', 'pswindows', [], false
46
47
 
47
48
  # Non-cygwin Windows
48
- it_should_behave_like 'enables_root_login', 'windows', [
49
+ it_behaves_like 'enables_root_login', 'windows', [
49
50
  "sed -ri 's/^#?PermitRootLogin /PermitRootLogin yes/' /etc/sshd_config"
50
51
  ], true
51
52
 
52
53
  # FreeBSD
53
- it_should_behave_like 'enables_root_login', 'freesbd', [
54
+ it_behaves_like 'enables_root_login', 'freesbd', [
54
55
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\""
55
56
  ], true
56
57
 
57
- it_should_behave_like 'enables_root_login', 'osx-10.10', [
58
+ it_behaves_like 'enables_root_login', 'osx-10.10', [
58
59
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /etc/sshd_config",
59
60
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /etc/sshd_config"
60
61
  ]
61
62
 
62
- it_should_behave_like 'enables_root_login', 'osx-10.11', [
63
+ it_behaves_like 'enables_root_login', 'osx-10.11', [
63
64
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
64
65
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config"
65
66
  ]
66
67
 
67
- it_should_behave_like 'enables_root_login', 'osx-10.12', [
68
+ it_behaves_like 'enables_root_login', 'osx-10.12', [
68
69
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
69
70
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config"
70
71
  ]
71
72
 
72
- it_should_behave_like 'enables_root_login', 'osx-10.13', [
73
+ it_behaves_like 'enables_root_login', 'osx-10.13', [
73
74
  "sudo sed -i '' 's/#PermitRootLogin yes/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config",
74
75
  "sudo sed -i '' 's/#PermitRootLogin no/PermitRootLogin Yes/g' /private/etc/ssh/sshd_config"
75
76
  ]
76
77
 
77
78
  # Solaris
78
- it_should_behave_like 'enables_root_login', 'solaris-10', [
79
+ it_behaves_like 'enables_root_login', 'solaris-10', [
79
80
  "sudo -E svcadm restart network/ssh",
80
81
  "sudo gsed -i -e 's/#PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config"
81
82
  ], true
82
83
 
83
- it_should_behave_like 'enables_root_login', 'solaris-11', [
84
+ it_behaves_like 'enables_root_login', 'solaris-11', [
84
85
  "sudo -E svcadm restart network/ssh",
85
86
  "sudo gsed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config",
86
87
  "if grep \"root::::type=role\" /etc/user_attr; then sudo rolemod -K type=normal root; else echo \"root user already type=normal\"; fi"
87
88
  ], true
88
89
 
89
90
  ['debian','ubuntu','cumulus'].each do | deb_like |
90
- it_should_behave_like 'enables_root_login', deb_like, [
91
+ it_behaves_like 'enables_root_login', deb_like, [
91
92
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
92
93
  "sudo su -c \"service ssh restart\""
93
94
  ]
94
95
  end
95
96
 
96
97
  ['centos','el-','redhat','fedora','eos'].each do | redhat_like |
97
- it_should_behave_like 'enables_root_login', redhat_like, [
98
+ it_behaves_like 'enables_root_login', redhat_like, [
98
99
  "sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
99
100
  "sudo -E /sbin/service sshd reload"
100
101
  ]
@@ -241,7 +242,7 @@ describe Beaker do
241
242
  it "does nothing on non debian/ubuntu/cumulus hosts" do
242
243
  host = make_host( 'testhost', { :platform => 'windows' } )
243
244
 
244
- expect( Beaker::Command ).to receive( :new ).never
245
+ expect( Beaker::Command ).not_to receive( :new )
245
246
 
246
247
  subject.apt_get_update( host )
247
248
 
@@ -318,7 +319,7 @@ describe Beaker do
318
319
  hosts = make_hosts( { :platform => 'solaris-11' } )
319
320
 
320
321
  expect( Beaker::Command ).to receive( :new ).with( "/usr/bin/pkg unset-publisher solaris || :" ).exactly( 3 ).times
321
- hosts.each do |host|
322
+ hosts.each do |_host|
322
323
  expect( Beaker::Command ).to receive( :new ).with( "/usr/bin/pkg set-publisher -g %s solaris" % ips_pkg_repo ).once
323
324
  end
324
325
 
@@ -329,7 +330,7 @@ describe Beaker do
329
330
  it "does nothing for non ubuntu/debian/cumulus/solaris-11 hosts" do
330
331
  hosts = make_hosts( { :platform => 'windows' } )
331
332
 
332
- expect( Beaker::Command ).to receive( :new ).never
333
+ expect( Beaker::Command ).not_to receive( :new )
333
334
 
334
335
  subject.proxy_config( hosts, options )
335
336
 
@@ -368,10 +369,10 @@ describe Beaker do
368
369
 
369
370
  end
370
371
 
371
- it "should do nothing for non el-5/6 hosts" do
372
+ it "does nothing for non el-5/6 hosts" do
372
373
  hosts = make_hosts( { :platform => Beaker::Platform.new('windows-version-arch') } )
373
374
 
374
- expect( Beaker::Command ).to receive( :new ).never
375
+ expect( Beaker::Command ).not_to receive( :new )
375
376
 
376
377
  subject.add_el_extras( hosts, options )
377
378
 
@@ -513,17 +514,21 @@ describe Beaker do
513
514
 
514
515
  context "with cygwin" do
515
516
  let(:cygwin) { true }
516
- before(:each) do
517
+
518
+ before do
517
519
  expect( Beaker::Command ).to receive( :new ).with( "cat /cygdrive/c/Windows/System32/drivers/etc/hosts" ).once
518
520
  end
521
+
519
522
  include_examples 'find domain name'
520
523
  end
521
524
 
522
525
  context "without cygwin" do
523
526
  let(:cygwin) { false }
524
- before(:each) do
527
+
528
+ before do
525
529
  expect( Beaker::Command ).to receive( :new ).with( 'type C:\Windows\System32\drivers\etc\hosts' ).once
526
530
  end
531
+
527
532
  include_examples 'find domain name'
528
533
  end
529
534
  end
@@ -535,7 +540,7 @@ describe Beaker do
535
540
  :stdout => stdout,
536
541
  } ) }
537
542
 
538
- before(:each) do
543
+ before do
539
544
  expect( Beaker::Command ).to receive( :new ).with( "cat /etc/resolv.conf" ).once
540
545
  end
541
546
 
@@ -618,6 +623,7 @@ describe Beaker do
618
623
  context "package_proxy" do
619
624
 
620
625
  subject { dummy_class.new }
626
+
621
627
  proxyurl = "http://192.168.2.100:3128"
622
628
 
623
629
  it "can set proxy config on a debian/ubuntu/cumulus host" do