beaker-puppet 1.29.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +9 -0
  3. data/.github/workflows/release.yml +3 -3
  4. data/.github/workflows/test.yml +28 -7
  5. data/.github_changelog_generator +3 -0
  6. data/.rubocop.yml +5 -0
  7. data/.rubocop_todo.yml +887 -0
  8. data/CHANGELOG.md +50 -0
  9. data/CODEOWNERS +1 -0
  10. data/Gemfile +5 -20
  11. data/README.md +4 -13
  12. data/Rakefile +64 -169
  13. data/acceptance/config/acceptance-options.rb +3 -3
  14. data/acceptance/config/gem/acceptance-options.rb +8 -8
  15. data/acceptance/config/git/acceptance-options.rb +8 -8
  16. data/acceptance/config/pkg/acceptance-options.rb +7 -7
  17. data/acceptance/pre_suite/gem/install.rb +6 -6
  18. data/acceptance/pre_suite/git/install.rb +22 -22
  19. data/acceptance/pre_suite/pkg/install.rb +3 -3
  20. data/acceptance/tests/backwards_compatible.rb +6 -7
  21. data/acceptance/tests/clone_git_repo_on_test.rb +12 -13
  22. data/acceptance/tests/create_tmpdir_on_test.rb +13 -9
  23. data/acceptance/tests/install_smoke_test.rb +5 -4
  24. data/acceptance/tests/stub_host.rb +11 -10
  25. data/acceptance/tests/web_helpers_test.rb +11 -10
  26. data/beaker-puppet.gemspec +17 -24
  27. data/bin/beaker-puppet +2 -4
  28. data/lib/beaker-puppet/helpers/facter_helpers.rb +9 -7
  29. data/lib/beaker-puppet/helpers/host_helpers.rb +10 -7
  30. data/lib/beaker-puppet/helpers/puppet_helpers.rb +145 -229
  31. data/lib/beaker-puppet/helpers/rake_helpers.rb +1 -1
  32. data/lib/beaker-puppet/helpers/tk_helpers.rb +22 -28
  33. data/lib/beaker-puppet/install_utils/aio_defaults.rb +39 -43
  34. data/lib/beaker-puppet/install_utils/ezbake_utils.rb +34 -42
  35. data/lib/beaker-puppet/install_utils/foss_defaults.rb +134 -138
  36. data/lib/beaker-puppet/install_utils/foss_utils.rb +269 -480
  37. data/lib/beaker-puppet/install_utils/module_utils.rb +58 -70
  38. data/lib/beaker-puppet/install_utils/puppet5.rb +30 -35
  39. data/lib/beaker-puppet/install_utils/puppet_utils.rb +53 -80
  40. data/lib/beaker-puppet/install_utils/windows_utils.rb +34 -36
  41. data/lib/beaker-puppet/version.rb +1 -1
  42. data/lib/beaker-puppet/wrappers.rb +13 -14
  43. data/lib/beaker-puppet.rb +4 -5
  44. data/release-prep.sh +11 -0
  45. data/setup/aio/010_Install_Puppet_Agent.rb +22 -9
  46. data/setup/common/000-delete-puppet-when-none.rb +2 -4
  47. data/setup/common/003_solaris_cert_fix.rb +74 -70
  48. data/setup/common/005_redhat_subscription_fix.rb +3 -2
  49. data/setup/common/011_Install_Puppet_Server.rb +7 -9
  50. data/setup/common/012_Finalize_Installs.rb +5 -5
  51. data/setup/common/025_StopFirewall.rb +1 -1
  52. data/setup/common/030_StopSssd.rb +2 -2
  53. data/setup/common/040_ValidateSignCert.rb +9 -18
  54. data/setup/common/045_EnsureMasterStarted.rb +2 -2
  55. data/setup/gem/010_GemInstall.rb +6 -5
  56. data/setup/git/000_EnvSetup.rb +48 -48
  57. data/setup/git/010_TestSetup.rb +13 -12
  58. data/setup/git/020_PuppetUserAndGroup.rb +3 -2
  59. data/setup/git/060_InstallModules.rb +14 -14
  60. data/setup/git/070_InstallCACerts.rb +82 -82
  61. data/spec/beaker-puppet/helpers/facter_helpers_spec.rb +22 -24
  62. data/spec/beaker-puppet/helpers/host_helpers_spec.rb +10 -6
  63. data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +463 -724
  64. data/spec/beaker-puppet/helpers/tk_helpers_spec.rb +20 -24
  65. data/spec/beaker-puppet/install_utils/ezbake_utils_spec.rb +86 -90
  66. data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +471 -863
  67. data/spec/beaker-puppet/install_utils/module_utils_spec.rb +125 -116
  68. data/spec/beaker-puppet/install_utils/puppet5_spec.rb +159 -165
  69. data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +89 -97
  70. data/spec/beaker-puppet/install_utils/windows_utils_spec.rb +101 -89
  71. data/spec/beaker-puppet/wrappers_spec.rb +10 -10
  72. data/spec/helpers.rb +85 -91
  73. data/tasks/ci.rake +188 -188
  74. metadata +38 -62
  75. data/setup/common/020_InstallCumulusModules.rb +0 -13
  76. data/setup/common/021_InstallAristaModuleMasters.rb +0 -12
  77. data/setup/common/022_InstallAristaModuleAgents.rb +0 -13
@@ -17,52 +17,60 @@ describe ClassMixedWithDSLInstallUtils do
17
17
  let(:metadata) { @metadata ||= {} }
18
18
  let(:presets) { Beaker::Options::Presets.new }
19
19
  let(:opts) { presets.presets.merge(presets.env_vars) }
20
- let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
21
- :platform => 'linux',
22
- :roles => [ 'agent' ] }, 4 ) }
23
- let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
24
- basic_hosts[1][:platform] = 'windows'
25
- basic_hosts[2][:platform] = 'osx-10.9-x86_64'
26
- basic_hosts[3][:platform] = 'eos'
27
- basic_hosts }
28
- let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
29
- let(:winhost) { make_host( 'winhost', { :platform => 'windows',
30
- :pe_ver => '3.0',
31
- :working_dir => '/tmp',
32
- :is_cygwin => true} ) }
33
- let(:winhost_non_cygwin) { make_host( 'winhost_non_cygwin', { :platform => 'windows',
34
- :pe_ver => '3.0',
35
- :working_dir => '/tmp',
36
- :is_cygwin => 'false' } ) }
37
- let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
38
- :pe_ver => '3.0',
39
- :working_dir => '/tmp' } ) }
40
- let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
41
- :pe_ver => '3.0',
42
- :working_dir => '/tmp',
43
- :dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386' } ) }
44
- let(:eoshost) { make_host( 'eoshost', { :platform => 'eos',
45
- :pe_ver => '3.0',
46
- :working_dir => '/tmp',
47
- :dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
48
-
49
- describe "#configure_defaults_on" do
50
-
51
- it "can set foss defaults" do
20
+ let(:basic_hosts) do
21
+ make_hosts({ pe_ver: '3.0',
22
+ platform: 'linux',
23
+ roles: ['agent'], }, 4)
24
+ end
25
+ let(:hosts) do
26
+ basic_hosts[0][:roles] = %w[master database dashboard]
27
+ basic_hosts[1][:platform] = 'windows'
28
+ basic_hosts[2][:platform] = 'osx-10.9-x86_64'
29
+ basic_hosts[3][:platform] = 'eos'
30
+ basic_hosts
31
+ end
32
+ let(:hosts_sorted) { [hosts[1], hosts[0], hosts[2], hosts[3]] }
33
+ let(:winhost) do
34
+ make_host('winhost', { platform: 'windows',
35
+ pe_ver: '3.0',
36
+ working_dir: '/tmp',
37
+ is_cygwin: true, })
38
+ end
39
+ let(:winhost_non_cygwin) do
40
+ make_host('winhost_non_cygwin', { platform: 'windows',
41
+ pe_ver: '3.0',
42
+ working_dir: '/tmp',
43
+ is_cygwin: 'false', })
44
+ end
45
+ let(:machost) do
46
+ make_host('machost', { platform: 'osx-10.9-x86_64',
47
+ pe_ver: '3.0',
48
+ working_dir: '/tmp', })
49
+ end
50
+ let(:unixhost) do
51
+ make_host('unixhost', { platform: 'linux',
52
+ pe_ver: '3.0',
53
+ working_dir: '/tmp',
54
+ dist: 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386', })
55
+ end
56
+ let(:eoshost) do
57
+ make_host('eoshost', { platform: 'eos',
58
+ pe_ver: '3.0',
59
+ working_dir: '/tmp',
60
+ dist: 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386', })
61
+ end
62
+
63
+ describe '#configure_defaults_on' do
64
+ it 'can set foss defaults' do
52
65
  expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
53
66
  subject.configure_defaults_on(hosts, 'foss')
54
67
  end
55
68
 
56
- it "can set aio defaults" do
69
+ it 'can set aio defaults' do
57
70
  expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
58
71
  subject.configure_defaults_on(hosts, 'aio')
59
72
  end
60
73
 
61
- it "can set pe defaults" do
62
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
63
- subject.configure_defaults_on(hosts, 'pe')
64
- end
65
-
66
74
  it 'can remove old defaults ands replace with new' do
67
75
  # fake the results of calling configure_pe_defaults_on
68
76
  hosts.each do |host|
@@ -74,9 +82,8 @@ describe ClassMixedWithDSLInstallUtils do
74
82
  end
75
83
  end
76
84
 
77
- describe "#configure_type_defaults_on" do
78
-
79
- it "can set foss defaults for foss type" do
85
+ describe '#configure_type_defaults_on' do
86
+ it 'can set foss defaults for foss type' do
80
87
  hosts.each do |host|
81
88
  host['type'] = 'foss'
82
89
  end
@@ -84,7 +91,7 @@ describe ClassMixedWithDSLInstallUtils do
84
91
  subject.configure_type_defaults_on(hosts)
85
92
  end
86
93
 
87
- it "adds aio defaults to foss hosts when they have an aio foss puppet version" do
94
+ it 'adds aio defaults to foss hosts when they have an aio foss puppet version' do
88
95
  hosts.each do |host|
89
96
  host[:pe_ver] = nil
90
97
  host[:version] = nil
@@ -96,7 +103,7 @@ describe ClassMixedWithDSLInstallUtils do
96
103
  subject.configure_type_defaults_on(hosts)
97
104
  end
98
105
 
99
- it "adds aio defaults to foss hosts when they have type foss-aio" do
106
+ it 'adds aio defaults to foss hosts when they have type foss-aio' do
100
107
  hosts.each do |host|
101
108
  host[:pe_ver] = nil
102
109
  host[:version] = nil
@@ -107,7 +114,7 @@ describe ClassMixedWithDSLInstallUtils do
107
114
  subject.configure_type_defaults_on(hosts)
108
115
  end
109
116
 
110
- it "can set aio defaults for aio type (backwards compatability)" do
117
+ it 'can set aio defaults for aio type (backwards compatability)' do
111
118
  hosts.each do |host|
112
119
  host[:pe_ver] = nil
113
120
  host[:version] = nil
@@ -116,70 +123,55 @@ describe ClassMixedWithDSLInstallUtils do
116
123
  expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
117
124
  subject.configure_type_defaults_on(hosts)
118
125
  end
119
-
120
- it "can set pe defaults for pe type" do
121
- hosts.each do |host|
122
- host['type'] = 'pe'
123
- end
124
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
125
- subject.configure_type_defaults_on(hosts)
126
- end
127
-
128
- it "adds aio defaults to pe hosts when they an aio pe version" do
129
- hosts.each do |host|
130
- host['type'] = 'pe'
131
- host['pe_ver'] = '4.0'
132
- end
133
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
134
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
135
- subject.configure_type_defaults_on(hosts)
136
- end
137
-
138
126
  end
139
127
 
140
128
  describe '#puppetserver_version_on' do
141
129
  it 'returns the tag on a released version' do
142
- result = object_double(Beaker::Result.new({}, 'puppetserver --version'), :stdout => "puppetserver version: 6.13.0", :exit_code => 0)
143
- expect(subject).to receive(:on).with(hosts.first, 'puppetserver --version', accept_all_exit_codes: true).and_return(result)
130
+ result = object_double(Beaker::Result.new({}, 'puppetserver --version'), stdout: 'puppetserver version: 6.13.0',
131
+ exit_code: 0)
132
+ expect(subject).to receive(:on).with(hosts.first, 'puppetserver --version',
133
+ accept_all_exit_codes: true).and_return(result)
144
134
  expect(subject.puppetserver_version_on(hosts.first)).to eq('6.13.0')
145
135
  end
146
136
 
147
137
  it 'returns the tag on a nightly version' do
148
- result = object_double(Beaker::Result.new({}, 'puppetserver --version'), :stdout => "puppetserver version: 7.0.0.SNAPSHOT.2020.10.14T0512", :exit_code => 0)
149
- expect(subject).to receive(:on).with(hosts.first, 'puppetserver --version', accept_all_exit_codes: true).and_return(result)
138
+ result = object_double(Beaker::Result.new({}, 'puppetserver --version'),
139
+ stdout: 'puppetserver version: 7.0.0.SNAPSHOT.2020.10.14T0512', exit_code: 0)
140
+ expect(subject).to receive(:on).with(hosts.first, 'puppetserver --version',
141
+ accept_all_exit_codes: true).and_return(result)
150
142
  expect(subject.puppetserver_version_on(hosts.first)).to eq('7.0.0')
151
143
  end
152
144
  end
153
145
 
154
146
  describe '#puppet_collection_for' do
155
147
  it 'raises an error when given an invalid package' do
156
- expect {
148
+ expect do
157
149
  subject.puppet_collection_for(:foo, '5.5.4')
158
- }.to raise_error(RuntimeError, /package must be one of puppet_agent, puppet, puppetserver/)
150
+ end.to raise_error(RuntimeError, /package must be one of puppet_agent, puppet, puppetserver/)
159
151
  end
160
152
 
161
153
  context 'when the :puppet_agent package is passed in' do
162
154
  context 'given a valid version' do
163
155
  {
164
- '1.10.14' => 'pc1',
165
- '1.10.x' => 'pc1',
166
- '5.3.1' => 'puppet5',
167
- '5.3.x' => 'puppet5',
168
- '5.99.0' => 'puppet6',
169
- '6.1.99-foo' => 'puppet6',
170
- '6.99.99' => 'puppet7',
171
- '7.0.0' => 'puppet7',
156
+ '1.10.14' => 'pc1',
157
+ '1.10.x' => 'pc1',
158
+ '5.3.1' => 'puppet5',
159
+ '5.3.x' => 'puppet5',
160
+ '5.99.0' => 'puppet6',
161
+ '6.1.99-foo' => 'puppet6',
162
+ '6.99.99' => 'puppet7',
163
+ '7.0.0' => 'puppet7',
172
164
  }.each do |version, collection|
173
165
  it "returns collection '#{collection}' for version '#{version}'" do
174
166
  expect(subject.puppet_collection_for(:puppet_agent, version)).to eq(collection)
175
167
  end
176
168
  end
177
169
  end
178
-
170
+
179
171
  it "returns the default, latest puppet collection given the version 'latest'" do
180
172
  expect(subject.puppet_collection_for(:puppet_agent, 'latest')).to eq('puppet')
181
173
  end
182
-
174
+
183
175
  context 'given an invalid version' do
184
176
  [nil, '', '0.1.0', '3.8.1', '', 'not-semver', 'not.semver.either'].each do |version|
185
177
  it "returns a nil collection value for version '#{version}'" do
@@ -192,14 +184,14 @@ describe ClassMixedWithDSLInstallUtils do
192
184
  context 'when the :puppet package is passed-in' do
193
185
  context 'given a valid version' do
194
186
  {
195
- '4.9.0' => 'pc1',
196
- '4.10.x' => 'pc1',
197
- '5.3.1' => 'puppet5',
198
- '5.3.x' => 'puppet5',
199
- '5.99.0' => 'puppet6',
200
- '6.1.99-foo' => 'puppet6',
201
- '6.99.99' => 'puppet7',
202
- '7.0.0' => 'puppet7',
187
+ '4.9.0' => 'pc1',
188
+ '4.10.x' => 'pc1',
189
+ '5.3.1' => 'puppet5',
190
+ '5.3.x' => 'puppet5',
191
+ '5.99.0' => 'puppet6',
192
+ '6.1.99-foo' => 'puppet6',
193
+ '6.99.99' => 'puppet7',
194
+ '7.0.0' => 'puppet7',
203
195
  }.each do |version, collection|
204
196
  it "returns collection '#{collection}' for version '#{version}'" do
205
197
  expect(subject.puppet_collection_for(:puppet, version)).to eq(collection)
@@ -223,25 +215,25 @@ describe ClassMixedWithDSLInstallUtils do
223
215
  context 'when the :puppetserver package is passed in' do
224
216
  context 'given a valid version' do
225
217
  {
226
- '2.0.0' => 'pc1',
227
- '2.0.x' => 'pc1',
228
- '5.3.1' => 'puppet5',
229
- '5.3.x' => 'puppet5',
230
- '5.99.0' => 'puppet6',
231
- '6.1.99-foo' => 'puppet6',
232
- '6.99.99' => 'puppet7',
233
- '7.0.0' => 'puppet7',
218
+ '2.0.0' => 'pc1',
219
+ '2.0.x' => 'pc1',
220
+ '5.3.1' => 'puppet5',
221
+ '5.3.x' => 'puppet5',
222
+ '5.99.0' => 'puppet6',
223
+ '6.1.99-foo' => 'puppet6',
224
+ '6.99.99' => 'puppet7',
225
+ '7.0.0' => 'puppet7',
234
226
  }.each do |version, collection|
235
227
  it "returns collection '#{collection}' for version '#{version}'" do
236
228
  expect(subject.puppet_collection_for(:puppetserver, version)).to eq(collection)
237
229
  end
238
230
  end
239
231
  end
240
-
232
+
241
233
  it "returns the default, latest puppet collection given the version 'latest'" do
242
234
  expect(subject.puppet_collection_for(:puppetserver, 'latest')).to eq('puppet')
243
235
  end
244
-
236
+
245
237
  context 'given an invalid version' do
246
238
  [nil, '', '0.1.0', '3.8.1', '', 'not-semver', 'not.semver.either'].each do |version|
247
239
  it "returns a nil collection value for version '#{version}'" do