beaker-puppet 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +2 -2
- data/.github_changelog_generator +3 -0
- data/.rubocop_todo.yml +52 -7
- data/CHANGELOG.md +14 -3
- data/CODEOWNERS +1 -0
- data/README.md +4 -13
- data/acceptance/tests/stub_host.rb +1 -1
- data/beaker-puppet.gemspec +3 -3
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +20 -95
- data/lib/beaker-puppet/install_utils/foss_utils.rb +10 -194
- data/lib/beaker-puppet/install_utils/puppet_utils.rb +0 -17
- data/lib/beaker-puppet/version.rb +1 -1
- data/release-prep.sh +11 -0
- data/setup/aio/010_Install_Puppet_Agent.rb +22 -8
- data/setup/common/040_ValidateSignCert.rb +4 -11
- data/setup/gem/010_GemInstall.rb +1 -1
- data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +1 -251
- data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +34 -463
- data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +0 -23
- data/tasks/ci.rake +27 -19
- metadata +11 -6
@@ -202,9 +202,9 @@ describe ClassMixedWithDSLInstallUtils do
|
|
202
202
|
context 'lookup_in_env' do
|
203
203
|
it 'returns a default properly' do
|
204
204
|
env_var = subject.lookup_in_env('noway', 'nonesuch', 'returnme')
|
205
|
-
expect(env_var).to
|
205
|
+
expect(env_var).to eq 'returnme'
|
206
206
|
env_var = subject.lookup_in_env('noway', nil, 'returnme')
|
207
|
-
expect(env_var).to
|
207
|
+
expect(env_var).to eq 'returnme'
|
208
208
|
end
|
209
209
|
it 'finds correct env variable' do
|
210
210
|
allow(ENV).to receive(:[]).with(nil).and_return(nil)
|
@@ -212,13 +212,13 @@ describe ClassMixedWithDSLInstallUtils do
|
|
212
212
|
allow(ENV).to receive(:[]).with('NONESUCH').and_return('present')
|
213
213
|
allow(ENV).to receive(:[]).with('NOWAY_PROJ_NONESUCH').and_return('exists')
|
214
214
|
env_var = subject.lookup_in_env('nonesuch', 'noway-proj', 'fail')
|
215
|
-
expect(env_var).to
|
215
|
+
expect(env_var).to eq 'exists'
|
216
216
|
env_var = subject.lookup_in_env('nonesuch')
|
217
|
-
expect(env_var).to
|
217
|
+
expect(env_var).to eq 'present'
|
218
218
|
env_var = subject.lookup_in_env('reallynone')
|
219
|
-
expect(env_var).to
|
219
|
+
expect(env_var).to eq nil # rubocop:disable Style/NilComparison
|
220
220
|
env_var = subject.lookup_in_env('reallynone', nil, 'default')
|
221
|
-
expect(env_var).to
|
221
|
+
expect(env_var).to eq 'default'
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
@@ -229,21 +229,21 @@ describe ClassMixedWithDSLInstallUtils do
|
|
229
229
|
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return(nil)
|
230
230
|
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return(nil)
|
231
231
|
url = subject.build_giturl('puppet')
|
232
|
-
expect(url).to
|
232
|
+
expect(url).to eq 'https://github.com/puppetlabs/puppet.git'
|
233
233
|
url = subject.build_giturl('puppet', 'er0ck')
|
234
|
-
expect(url).to
|
234
|
+
expect(url).to eq 'https://github.com/er0ck/puppet.git'
|
235
235
|
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
|
236
|
-
expect(url).to
|
236
|
+
expect(url).to eq 'https://bitbucket.com/er0ck-puppet.git'
|
237
237
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
|
238
|
-
expect(url).to
|
238
|
+
expect(url).to eq 'https://github.com/er0ck/puppet.git'
|
239
239
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
|
240
|
-
expect(url).to
|
240
|
+
expect(url).to eq 'https://github.com/er0ck/puppet.git'
|
241
241
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
|
242
|
-
expect(url).to
|
242
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
243
243
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
|
244
|
-
expect(url).to
|
244
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
245
245
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
|
246
|
-
expect(url).to
|
246
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
247
247
|
end
|
248
248
|
|
249
249
|
it 'uses ENV to build urls properly' do
|
@@ -252,21 +252,21 @@ describe ClassMixedWithDSLInstallUtils do
|
|
252
252
|
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return('er0ck/repo')
|
253
253
|
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return('gitlab.com')
|
254
254
|
url = subject.build_giturl('puppet')
|
255
|
-
expect(url).to
|
255
|
+
expect(url).to eq 'https://gitlab.com/er0ck/repo-puppet.git'
|
256
256
|
url = subject.build_giturl('puppet', 'er0ck')
|
257
|
-
expect(url).to
|
257
|
+
expect(url).to eq 'https://gitlab.com/er0ck-puppet.git'
|
258
258
|
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
|
259
|
-
expect(url).to
|
259
|
+
expect(url).to eq 'https://bitbucket.com/er0ck-puppet.git'
|
260
260
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
|
261
|
-
expect(url).to
|
261
|
+
expect(url).to eq 'https://github.com/er0ck/puppet.git'
|
262
262
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
|
263
|
-
expect(url).to
|
263
|
+
expect(url).to eq 'https://github.com/er0ck/puppet.git'
|
264
264
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
|
265
|
-
expect(url).to
|
265
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
266
266
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
|
267
|
-
expect(url).to
|
267
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
268
268
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
|
269
|
-
expect(url).to
|
269
|
+
expect(url).to eq 'git@github.com:er0ck/puppet.git'
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
@@ -278,9 +278,9 @@ describe ClassMixedWithDSLInstallUtils do
|
|
278
278
|
it "handles #{type[:protocol]} uris" do
|
279
279
|
uri = "#{type[:path]}#master"
|
280
280
|
repo_info = subject.extract_repo_info_from uri
|
281
|
-
expect(repo_info[:name]).to
|
282
|
-
expect(repo_info[:path]).to
|
283
|
-
expect(repo_info[:rev]).to
|
281
|
+
expect(repo_info[:name]).to eq 'project'
|
282
|
+
expect(repo_info[:path]).to eq type[:path]
|
283
|
+
expect(repo_info[:rev]).to eq 'master'
|
284
284
|
end
|
285
285
|
end
|
286
286
|
end
|
@@ -291,9 +291,9 @@ describe ClassMixedWithDSLInstallUtils do
|
|
291
291
|
{ name: 'puppet_plugin' }, { name: 'puppet' }, { name: 'facter' },
|
292
292
|
]
|
293
293
|
ordered_repos = subject.order_packages named_repos
|
294
|
-
expect(ordered_repos[0][:name]).to
|
295
|
-
expect(ordered_repos[1][:name]).to
|
296
|
-
expect(ordered_repos[2][:name]).to
|
294
|
+
expect(ordered_repos[0][:name]).to eq 'facter'
|
295
|
+
expect(ordered_repos[1][:name]).to eq 'puppet'
|
296
|
+
expect(ordered_repos[2][:name]).to eq 'puppet_plugin'
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
@@ -313,7 +313,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
313
313
|
subject.instance_variable_set(:@metadata, {})
|
314
314
|
version = subject.find_git_repo_versions(host, path, repository)
|
315
315
|
|
316
|
-
expect(version).to be == { 'name' => '2' }
|
316
|
+
expect(version).to be == { 'name' => '2' } # rubocop:ignore RSpec/Eq
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|
@@ -1005,7 +1005,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1005
1005
|
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
1006
1006
|
|
1007
1007
|
subject.install_puppet_agent_from_msi_on(host, opts)
|
1008
|
-
expect(host['dist']).to
|
1008
|
+
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
|
1009
1009
|
end
|
1010
1010
|
|
1011
1011
|
it 'uses x86 msi when host is_x86_64 and install_32 is set on the options' do
|
@@ -1015,7 +1015,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1015
1015
|
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
1016
1016
|
|
1017
1017
|
subject.install_puppet_agent_from_msi_on(host, opts)
|
1018
|
-
expect(host['dist']).to
|
1018
|
+
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
|
1019
1019
|
end
|
1020
1020
|
|
1021
1021
|
it 'uses x86 msi when host is_x86_64 and ruby_arch is x86 on the host' do
|
@@ -1025,7 +1025,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1025
1025
|
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
1026
1026
|
|
1027
1027
|
subject.install_puppet_agent_from_msi_on(host, opts)
|
1028
|
-
expect(host['dist']).to
|
1028
|
+
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
|
1029
1029
|
end
|
1030
1030
|
|
1031
1031
|
it 'uses x86 msi when host !is_x86_64' do
|
@@ -1033,7 +1033,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1033
1033
|
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
1034
1034
|
|
1035
1035
|
subject.install_puppet_agent_from_msi_on(host, opts)
|
1036
|
-
expect(host['dist']).to
|
1036
|
+
expect(host['dist']).to eq 'puppet-agent-VERSION-x86'
|
1037
1037
|
end
|
1038
1038
|
|
1039
1039
|
it 'uses x64 msi when host is_x86_64, no install_32 and ruby_arch != x86' do
|
@@ -1041,7 +1041,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1041
1041
|
expect(subject).to receive(:install_a_puppet_msi_on).with(host, opts)
|
1042
1042
|
|
1043
1043
|
subject.install_puppet_agent_from_msi_on(host, opts)
|
1044
|
-
expect(host['dist']).to
|
1044
|
+
expect(host['dist']).to eq 'puppet-agent-VERSION-x64'
|
1045
1045
|
end
|
1046
1046
|
end
|
1047
1047
|
|
@@ -1092,435 +1092,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1092
1092
|
end
|
1093
1093
|
end
|
1094
1094
|
|
1095
|
-
describe '#install_puppet_agent_dev_repo_on' do
|
1096
|
-
let(:package_name) { 'puppet-agent' }
|
1097
|
-
let(:platform) { @platform || 'other' }
|
1098
|
-
let(:host) do
|
1099
|
-
FakeHost.create('fakvm', platform, opts)
|
1100
|
-
end
|
1101
|
-
|
1102
|
-
before :each do
|
1103
|
-
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
1104
|
-
end
|
1105
|
-
|
1106
|
-
it 'raises an exception when host platform is unsupported' do
|
1107
|
-
host = basic_hosts.first
|
1108
|
-
host['platform'] = Beaker::Platform.new('f5-5-x4')
|
1109
|
-
opts = { version: '0.1.0' }
|
1110
|
-
allow(subject).to receive(:options).and_return({})
|
1111
|
-
|
1112
|
-
expect do
|
1113
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1114
|
-
end.to raise_error(RuntimeError, /No repository installation step for/)
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
it 'runs the correct install for el-based platforms' do
|
1118
|
-
host = basic_hosts.first
|
1119
|
-
host['platform'] = Beaker::Platform.new('el-5-x86_64')
|
1120
|
-
sha_value = 'ereiuwoiur'
|
1121
|
-
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1122
|
-
allow(subject).to receive(:options).and_return({})
|
1123
|
-
|
1124
|
-
expect(subject).to receive(:install_puppetlabs_dev_repo).with(
|
1125
|
-
host, 'puppet-agent', sha_value, nil, anything
|
1126
|
-
)
|
1127
|
-
expect(host).to receive(:install_package).with('puppet-agent')
|
1128
|
-
|
1129
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1130
|
-
end
|
1131
|
-
|
1132
|
-
it 'runs the correct install for el-based platforms on s390x architectures' do
|
1133
|
-
host = basic_hosts.first
|
1134
|
-
host['platform'] = Beaker::Platform.new('el-5-s390x')
|
1135
|
-
sha_value = 'ereiuwoiur'
|
1136
|
-
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1137
|
-
allow(subject).to receive(:options).and_return({})
|
1138
|
-
|
1139
|
-
release_path_end = 'fake_release_path_end'
|
1140
|
-
release_file = 'fake_29835_release_file'
|
1141
|
-
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1142
|
-
[release_path_end, release_file],
|
1143
|
-
)
|
1144
|
-
|
1145
|
-
expect(subject).not_to receive(:install_puppetlabs_dev_repo)
|
1146
|
-
expect(host).not_to receive(:install_package)
|
1147
|
-
|
1148
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/el$})
|
1149
|
-
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, anything)
|
1150
|
-
expect(subject).to receive(:on).ordered.with(host, /rpm -ivh.*#{release_file}$/)
|
1151
|
-
|
1152
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1153
|
-
end
|
1154
|
-
|
1155
|
-
it 'runs the correct agent install for el-based platforms on ec2 hypervisor' do
|
1156
|
-
host = basic_hosts.first
|
1157
|
-
host['platform'] = Beaker::Platform.new('el-5-x86_64')
|
1158
|
-
host['hypervisor'] = 'ec2'
|
1159
|
-
sha_value = 'ereiuwoiur'
|
1160
|
-
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1161
|
-
allow(subject).to receive(:options).and_return({})
|
1162
|
-
|
1163
|
-
release_path_end = 'fake_release_path_end'
|
1164
|
-
release_file = 'fake_29835_release_file'
|
1165
|
-
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1166
|
-
[release_path_end, release_file],
|
1167
|
-
)
|
1168
|
-
|
1169
|
-
expect(subject).not_to receive(:install_puppetlabs_dev_repo)
|
1170
|
-
expect(host).not_to receive(:install_package)
|
1171
|
-
|
1172
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/el$})
|
1173
|
-
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, anything)
|
1174
|
-
expect(subject).to receive(:on).ordered.with(host, /rpm -ivh.*#{release_file}$/)
|
1175
|
-
|
1176
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
it 'runs the correct install for debian-based platforms' do
|
1180
|
-
platform = Beaker::Platform.new('debian-5-x86_64')
|
1181
|
-
host = basic_hosts.first
|
1182
|
-
host['platform'] = platform
|
1183
|
-
sha_value = 'ereigregerge'
|
1184
|
-
opts = { version: '0.1.0', puppet_agent_sha: sha_value }
|
1185
|
-
allow(subject).to receive(:options).and_return({})
|
1186
|
-
|
1187
|
-
expect(subject).to receive(:install_puppetlabs_dev_repo).with(
|
1188
|
-
host, 'puppet-agent', sha_value, nil, anything
|
1189
|
-
)
|
1190
|
-
expect(host).to receive(:install_package).with('puppet-agent')
|
1191
|
-
|
1192
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1193
|
-
end
|
1194
|
-
|
1195
|
-
it 'runs the correct install for windows platforms' do
|
1196
|
-
host = winhost
|
1197
|
-
external_copy_base = 'tmp_install_windows_copy_base_1325'
|
1198
|
-
allow(host).to receive(:external_copy_base).and_return(external_copy_base)
|
1199
|
-
opts = { version: '0.1.0' }
|
1200
|
-
allow(subject).to receive(:options).and_return({})
|
1201
|
-
copied_path = "#{win_temp}\\puppet-agent-0.1.0-x64.msi"
|
1202
|
-
mock_echo = Object.new
|
1203
|
-
allow(mock_echo).to receive(:raw_output).and_return(copied_path)
|
1204
|
-
|
1205
|
-
expect(subject).to receive(:fetch_http_file).once.with(%r{/windows$}, 'puppet-agent-0.1.0-x64.msi', %r{/windows$})
|
1206
|
-
expect(subject).to receive(:scp_to).once.with(host, %r{/puppet-agent-0.1.0-x64.msi$}, /#{external_copy_base}/)
|
1207
|
-
expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, { debug: nil }).once
|
1208
|
-
expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
|
1209
|
-
|
1210
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
it 'runs the correct install for osx platforms' do
|
1214
|
-
host = machost
|
1215
|
-
host['platform'] = Beaker::Platform.new('osx-109-x86_64')
|
1216
|
-
sha_value = 'runs the correct install for osx platforms'
|
1217
|
-
copy_dir_external = 'fake_15_copy_dir_external'
|
1218
|
-
opts = {
|
1219
|
-
version: '0.1.0',
|
1220
|
-
puppet_agent_sha: sha_value,
|
1221
|
-
copy_dir_external: copy_dir_external,
|
1222
|
-
}
|
1223
|
-
|
1224
|
-
release_path_end = 'fake_release_path_end'
|
1225
|
-
release_file = 'fake_29835_release_file'
|
1226
|
-
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1227
|
-
[release_path_end, release_file],
|
1228
|
-
)
|
1229
|
-
|
1230
|
-
expect(subject).to receive(:fetch_http_file).once.with(/#{release_path_end}$/, release_file, %r{/osx$})
|
1231
|
-
expect(subject).to receive(:scp_to).once.with(host, /#{release_file}$/, copy_dir_external)
|
1232
|
-
# the star is necessary, as that's not the entire filename, & we rely on
|
1233
|
-
# the globbing to get this right on OSX SUTs
|
1234
|
-
expect(host).to receive(:install_package).with(/^puppet-agent-0.1.0\*$/)
|
1235
|
-
|
1236
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
it 'runs the correct install for solaris platforms' do
|
1240
|
-
@platform = 'solaris-10-x86_64'
|
1241
|
-
opts = { version: '0.1.0' }
|
1242
|
-
allow(subject).to receive(:options).and_return({})
|
1243
|
-
|
1244
|
-
release_path_end = 'fake_release_path_end'
|
1245
|
-
release_file = 'fake_sol10_8495_release_file'
|
1246
|
-
expect(host).to receive(:puppet_agent_dev_package_info).and_return(
|
1247
|
-
[release_path_end, release_file],
|
1248
|
-
)
|
1249
|
-
|
1250
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1251
|
-
/#{release_path_end}$/, release_file, anything
|
1252
|
-
)
|
1253
|
-
expect(subject).to receive(:scp_to).once.with(
|
1254
|
-
host, /#{release_file}$/, anything
|
1255
|
-
)
|
1256
|
-
|
1257
|
-
expect(host).to receive(:solaris_install_local_package)
|
1258
|
-
|
1259
|
-
allow(subject).to receive(:configure_type_defaults_on)
|
1260
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1261
|
-
end
|
1262
|
-
|
1263
|
-
it 'allows you to override the local copy directory' do
|
1264
|
-
# only applies to hosts that don't go down the
|
1265
|
-
# install_puppetlabs_dev_repo route
|
1266
|
-
host = eoshost
|
1267
|
-
host['platform'] = Beaker::Platform.new('eos-5-x86_64')
|
1268
|
-
sha_value = 'dahdahdahdah'
|
1269
|
-
copy_base_local_override = 'face'
|
1270
|
-
opts = {
|
1271
|
-
version: '0.1.0',
|
1272
|
-
copy_base_local: copy_base_local_override,
|
1273
|
-
puppet_agent_sha: sha_value,
|
1274
|
-
}
|
1275
|
-
allow(subject).to receive(:options).and_return({})
|
1276
|
-
|
1277
|
-
allow(host).to receive(:puppet_agent_dev_package_info).and_return(['', ''])
|
1278
|
-
|
1279
|
-
allow(host).to receive(:get_remote_file).once.with(anything)
|
1280
|
-
allow(host).to receive(:install_from_file)
|
1281
|
-
|
1282
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1283
|
-
end
|
1284
|
-
|
1285
|
-
it 'allows you to override the external copy directory' do
|
1286
|
-
host = basic_hosts.first
|
1287
|
-
host['platform'] = Beaker::Platform.new('osx-5-x86_64')
|
1288
|
-
copy_dir_custom = 'muppetsBB8-1435'
|
1289
|
-
opts = { version: '0.1.0', copy_dir_external: copy_dir_custom }
|
1290
|
-
allow(subject).to receive(:options).and_return({})
|
1291
|
-
|
1292
|
-
allow(host).to receive(:puppet_agent_dev_package_info).and_return(['', ''])
|
1293
|
-
|
1294
|
-
allow(subject).to receive(:fetch_http_file).once
|
1295
|
-
expect(subject).to receive(:scp_to).once.with(
|
1296
|
-
host, anything, /#{copy_dir_custom}/
|
1297
|
-
)
|
1298
|
-
allow(host).to receive(:install_package)
|
1299
|
-
|
1300
|
-
subject.install_puppet_agent_dev_repo_on(host, opts)
|
1301
|
-
end
|
1302
|
-
|
1303
|
-
it 'copies package to the cygwin root directory and installs it' do
|
1304
|
-
@platform = 'windows-7-x86_64'
|
1305
|
-
expect(subject).to receive(:install_msi_on).with(any_args)
|
1306
|
-
copy_base = 'copy_base_cygwin'
|
1307
|
-
allow(host).to receive(:external_copy_base).and_return(copy_base)
|
1308
|
-
expect(subject).to receive(:scp_to).with(host, /puppet-agent-1\.0\.0-x64\.msi/, /#{copy_base}/)
|
1309
|
-
expect(subject).to receive(:configure_type_defaults_on).with(host)
|
1310
|
-
expect(subject).to receive(:fetch_http_file).with(%r{[^/]\z}, anything, anything)
|
1311
|
-
subject.install_puppet_agent_dev_repo_on(host, opts.merge({ puppet_agent_version: '1.0.0' }))
|
1312
|
-
end
|
1313
|
-
|
1314
|
-
it 'installs on different hosts without erroring' do
|
1315
|
-
mhosts = hosts
|
1316
|
-
mhosts[3] = eoshost
|
1317
|
-
|
1318
|
-
mhosts.each_with_index do |host, index|
|
1319
|
-
if index == 0
|
1320
|
-
host['platform'] = Beaker::Platform.new('solaris-5-x4')
|
1321
|
-
allow(host).to receive(:external_copy_base) { '/host0' }
|
1322
|
-
elsif index == 1
|
1323
|
-
host['platform'] = Beaker::Platform.new('windows-5-x4')
|
1324
|
-
allow(host).to receive(:external_copy_base) { '/host1' }
|
1325
|
-
elsif index == 2
|
1326
|
-
host['platform'] = Beaker::Platform.new('osx-5-x4')
|
1327
|
-
allow(host).to receive(:external_copy_base) { '/host2' }
|
1328
|
-
elsif index == 3
|
1329
|
-
host['platform'] = Beaker::Platform.new('eos-5-x4')
|
1330
|
-
allow(host).to receive(:external_copy_base) { '/host3' }
|
1331
|
-
end
|
1332
|
-
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(%w[test blah])
|
1333
|
-
end
|
1334
|
-
|
1335
|
-
expect(subject).to receive(:add_role).with(any_args).exactly(mhosts.length).times
|
1336
|
-
|
1337
|
-
expect(subject).to receive(:fetch_http_file).with(any_args).exactly(3).times
|
1338
|
-
expect(subject).to receive(:scp_to).with(any_args).exactly(3).times
|
1339
|
-
|
1340
|
-
expect(subject).to receive(:install_msi_on).with(mhosts[1], 'xyz', {}, anything).exactly(1).times
|
1341
|
-
expect(mhosts[0]).to receive(:solaris_install_local_package).with('blah', '/host0').exactly(1).times
|
1342
|
-
expect(mhosts[2]).to receive(:install_package).with(any_args).exactly(1).times
|
1343
|
-
expect(mhosts[3]).to receive(:install_from_file).with('blah').exactly(1).times
|
1344
|
-
|
1345
|
-
result = object_double(Beaker::Result.new({}, 'foo'), raw_output: 'xyz')
|
1346
|
-
allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
|
1347
|
-
|
1348
|
-
expect(subject).to receive(:configure_type_defaults_on).with(any_args).exactly(mhosts.length).times
|
1349
|
-
|
1350
|
-
subject.install_puppet_agent_dev_repo_on(mhosts, opts.merge({ puppet_agent_version: '1.0.0' }))
|
1351
|
-
end
|
1352
|
-
|
1353
|
-
it 'installs on different hosts with options specifying :copy_dir_external' do
|
1354
|
-
mhosts = hosts
|
1355
|
-
mhosts[3] = eoshost
|
1356
|
-
|
1357
|
-
mhosts.each_with_index do |host, index|
|
1358
|
-
if index == 0
|
1359
|
-
host['platform'] = Beaker::Platform.new('solaris-5-x4')
|
1360
|
-
allow(host).to receive(:external_copy_base) { '/host0' }
|
1361
|
-
elsif index == 1
|
1362
|
-
host['platform'] = Beaker::Platform.new('windows-5-x4')
|
1363
|
-
allow(host).to receive(:external_copy_base) { '/host1' }
|
1364
|
-
elsif index == 2
|
1365
|
-
host['platform'] = Beaker::Platform.new('osx-5-x4')
|
1366
|
-
allow(host).to receive(:external_copy_base) { '/host2' }
|
1367
|
-
elsif index == 3
|
1368
|
-
host['platform'] = Beaker::Platform.new('eos-5-x4')
|
1369
|
-
allow(host).to receive(:external_copy_base) { '/host3' }
|
1370
|
-
end
|
1371
|
-
allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(['test', '/blah'])
|
1372
|
-
end
|
1373
|
-
|
1374
|
-
expect(subject).to receive(:add_role).with(any_args).exactly(mhosts.length).times
|
1375
|
-
|
1376
|
-
expect(subject).to receive(:fetch_http_file).with(any_args).exactly(3).times
|
1377
|
-
expect(subject).to receive(:scp_to).with(any_args).exactly(3).times
|
1378
|
-
|
1379
|
-
expect(subject).to receive(:install_msi_on).with(mhosts[1], 'xyz', {}, anything).exactly(1).times
|
1380
|
-
expect(mhosts[0]).to receive(:solaris_install_local_package).with('/blah', '/tmp').exactly(1).times
|
1381
|
-
expect(mhosts[2]).to receive(:install_package).with(any_args).exactly(1).times
|
1382
|
-
expect(mhosts[3]).to receive(:install_from_file).with('/blah').exactly(1).times
|
1383
|
-
expect(mhosts[0]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1384
|
-
expect(mhosts[1]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1385
|
-
expect(mhosts[2]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1386
|
-
expect(mhosts[3]).to receive(:external_copy_base).with(no_args).exactly(0).times
|
1387
|
-
|
1388
|
-
result = object_double(Beaker::Result.new({}, 'foo'), raw_output: 'xyz')
|
1389
|
-
allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
|
1390
|
-
|
1391
|
-
expect(subject).to receive(:configure_type_defaults_on).with(any_args).exactly(mhosts.length).times
|
1392
|
-
|
1393
|
-
subject.install_puppet_agent_dev_repo_on(mhosts,
|
1394
|
-
opts.merge({ puppet_agent_version: '1.0.0', copy_dir_external: '/tmp' }))
|
1395
|
-
end
|
1396
|
-
end
|
1397
|
-
|
1398
|
-
describe '#install_puppet_agent_pe_promoted_repo_on' do
|
1399
|
-
let(:package_name) { 'puppet-agent' }
|
1400
|
-
let(:platform) { @platform || 'other' }
|
1401
|
-
let(:host) do
|
1402
|
-
FakeHost.create('fakvm', platform, opts)
|
1403
|
-
end
|
1404
|
-
|
1405
|
-
before :each do
|
1406
|
-
allow(subject).to receive(:configure_foss_defaults_on).and_return(true)
|
1407
|
-
allow(subject).to receive(:install_msi_on).with(any_args)
|
1408
|
-
end
|
1409
|
-
|
1410
|
-
def test_fetch_http_file_no_ending_slash(platform)
|
1411
|
-
@platform = platform
|
1412
|
-
allow(subject).to receive(:scp_to)
|
1413
|
-
allow(subject).to receive(:configure_type_defaults_on).with(host)
|
1414
|
-
|
1415
|
-
expect(subject).to receive(:fetch_http_file).with(%r{[^/]\z}, anything, anything)
|
1416
|
-
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1417
|
-
end
|
1418
|
-
|
1419
|
-
context 'on windows' do
|
1420
|
-
it 'calls fetch_http_file with no ending slash' do
|
1421
|
-
test_fetch_http_file_no_ending_slash('windows-7-x86_64')
|
1422
|
-
end
|
1423
|
-
end
|
1424
|
-
|
1425
|
-
it 'calls fetch_http_file with no ending slash' do
|
1426
|
-
test_fetch_http_file_no_ending_slash('debian-5-x86_64')
|
1427
|
-
end
|
1428
|
-
|
1429
|
-
context 'when setting different agent versions' do
|
1430
|
-
let(:host) { basic_hosts.first }
|
1431
|
-
let(:platform) { Beaker::Platform.new('el-6-x86_64') }
|
1432
|
-
let(:downloadurl) { 'http://pm.puppet.com' }
|
1433
|
-
before :each do
|
1434
|
-
allow(subject).to receive(:options).and_return(opts)
|
1435
|
-
allow(subject).to receive(:scp_to)
|
1436
|
-
allow(subject).to receive(:configure_type_defaults_on).with(host)
|
1437
|
-
end
|
1438
|
-
|
1439
|
-
it 'sets correct file paths when agent version is set to latest' do
|
1440
|
-
host['platform'] = platform
|
1441
|
-
agentversion = 'latest'
|
1442
|
-
collection = 'puppet'
|
1443
|
-
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1444
|
-
|
1445
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1446
|
-
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1447
|
-
/puppet-agent-el-6*/,
|
1448
|
-
%r{/el$},
|
1449
|
-
)
|
1450
|
-
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1451
|
-
anything,
|
1452
|
-
/puppet-agent-el-6*/,
|
1453
|
-
%r{.*/el/6/#{collection}/.*rpm},
|
1454
|
-
/puppet-agent-el-6/,
|
1455
|
-
anything,
|
1456
|
-
)
|
1457
|
-
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1458
|
-
end
|
1459
|
-
|
1460
|
-
it 'sets correct file paths for agent version 1.x.x' do
|
1461
|
-
host['platform'] = platform
|
1462
|
-
agentversion = '1.x.x'
|
1463
|
-
collection = 'pc1'
|
1464
|
-
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1465
|
-
|
1466
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1467
|
-
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1468
|
-
/puppet-agent-el-6*/, %r{/el$}
|
1469
|
-
)
|
1470
|
-
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1471
|
-
anything,
|
1472
|
-
/puppet-agent-el-6*/,
|
1473
|
-
%r{.*/el/6/#{collection}/.*rpm},
|
1474
|
-
/puppet-agent-el-6/,
|
1475
|
-
anything,
|
1476
|
-
)
|
1477
|
-
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1478
|
-
end
|
1479
|
-
|
1480
|
-
it 'sets correct file paths for agent version >= 5.5.4' do
|
1481
|
-
host['platform'] = platform
|
1482
|
-
agentversion = '5.5.4'
|
1483
|
-
collection = 'puppet5'
|
1484
|
-
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1485
|
-
|
1486
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1487
|
-
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1488
|
-
/puppet-agent-el-6*/,
|
1489
|
-
%r{/el$},
|
1490
|
-
)
|
1491
|
-
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1492
|
-
anything,
|
1493
|
-
/puppet-agent-el-6*/,
|
1494
|
-
%r{.*/el/6/#{collection}/.*rpm},
|
1495
|
-
/puppet-agent-el-6/,
|
1496
|
-
anything,
|
1497
|
-
)
|
1498
|
-
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1499
|
-
end
|
1500
|
-
|
1501
|
-
it 'sets correct file paths for agent version > 5.99' do
|
1502
|
-
host['platform'] = platform
|
1503
|
-
agentversion = '6.0.0'
|
1504
|
-
collection = 'puppet6'
|
1505
|
-
opts = { puppet_agent_version: "#{agentversion}", pe_promoted_builds_url: "#{downloadurl}" }
|
1506
|
-
|
1507
|
-
expect(subject).to receive(:fetch_http_file).once.with(
|
1508
|
-
%r{pm\.puppet\.com/puppet-agent/.*/#{agentversion}/repos},
|
1509
|
-
/puppet-agent-el-6*/,
|
1510
|
-
%r{/el$},
|
1511
|
-
)
|
1512
|
-
expect(host).to receive(:pe_puppet_agent_promoted_package_install).with(
|
1513
|
-
anything,
|
1514
|
-
/puppet-agent-el-6*/,
|
1515
|
-
%r{.*/el/6/#{collection}/.*rpm},
|
1516
|
-
/puppet-agent-el-6/,
|
1517
|
-
anything,
|
1518
|
-
)
|
1519
|
-
subject.install_puppet_agent_pe_promoted_repo_on(host, opts)
|
1520
|
-
end
|
1521
|
-
end
|
1522
|
-
end
|
1523
|
-
|
1524
1095
|
describe '#install_puppetserver_on' do
|
1525
1096
|
let(:host) { make_host('master', platform: 'el-7-x86_64') }
|
1526
1097
|
|
@@ -71,11 +71,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
71
71
|
subject.configure_defaults_on(hosts, 'aio')
|
72
72
|
end
|
73
73
|
|
74
|
-
it 'can set pe defaults' do
|
75
|
-
expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
|
76
|
-
subject.configure_defaults_on(hosts, 'pe')
|
77
|
-
end
|
78
|
-
|
79
74
|
it 'can remove old defaults ands replace with new' do
|
80
75
|
# fake the results of calling configure_pe_defaults_on
|
81
76
|
hosts.each do |host|
|
@@ -128,24 +123,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
128
123
|
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
129
124
|
subject.configure_type_defaults_on(hosts)
|
130
125
|
end
|
131
|
-
|
132
|
-
it 'can set pe defaults for pe type' do
|
133
|
-
hosts.each do |host|
|
134
|
-
host['type'] = 'pe'
|
135
|
-
end
|
136
|
-
expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
|
137
|
-
subject.configure_type_defaults_on(hosts)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'adds aio defaults to pe hosts when they an aio pe version' do
|
141
|
-
hosts.each do |host|
|
142
|
-
host['type'] = 'pe'
|
143
|
-
host['pe_ver'] = '4.0'
|
144
|
-
end
|
145
|
-
expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
|
146
|
-
expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
|
147
|
-
subject.configure_type_defaults_on(hosts)
|
148
|
-
end
|
149
126
|
end
|
150
127
|
|
151
128
|
describe '#puppetserver_version_on' do
|