beaker-puppet 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/beaker-puppet.rb +4 -0
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +3 -2
- data/lib/beaker-puppet/install_utils/foss_utils.rb +21 -3
- data/lib/beaker-puppet/install_utils/puppet5.rb +171 -0
- data/lib/beaker-puppet/version.rb +1 -1
- data/spec/beaker-puppet/install_utils/puppet5_spec.rb +282 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODMyNzY5MjBiMWEyNGVmZTUyZmQzMWEyNjZkMjIzYTAzNDdmYjdmNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzVkNmJmZmI0ZTczZmVmYWQ3MTgzOGJkZGJmNTBhZTk4OThlMmI5Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDE4ZWYyZjE3NmYxNWJhMWQ1YzE4YTFjZDczZGI4MzA4NGJmM2JkZDExMDJm
|
10
|
+
ZjI5ODM1M2RhMWE0OTIzMWE0MDhhMzBiMWViNmQ0NzZhZjA5NjYzZWFmYWQz
|
11
|
+
MGZkZTgwOTBkZjg2OWRiMWVkOWI0MzJhYWE0ZGQ0ZDZiZmE1ZGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzUzN2I1ZTA5MThiMjFkYTNiMzJlNzNlMzIzZDM3ZmMyYjFmMGZlYzljY2Nk
|
14
|
+
NzA2ZGNhOTVhM2FiMmQ0Njc0NWFmODZhOTFiMDI0OGRjYTJlYjBmNmYyOWRl
|
15
|
+
Y2MxNDgyN2I3ZDI5MTYxN2Q1NDExYWJiZjFiZjkwOWNhOTBiN2E=
|
data/lib/beaker-puppet.rb
CHANGED
@@ -13,6 +13,8 @@ end
|
|
13
13
|
require "beaker-puppet/helpers/#{lib}_helpers"
|
14
14
|
end
|
15
15
|
|
16
|
+
require 'beaker-puppet/install_utils/puppet5'
|
17
|
+
|
16
18
|
|
17
19
|
module BeakerPuppet
|
18
20
|
module InstallUtils
|
@@ -23,6 +25,8 @@ module BeakerPuppet
|
|
23
25
|
include Beaker::DSL::InstallUtils::FOSSUtils
|
24
26
|
include Beaker::DSL::InstallUtils::EZBakeUtils
|
25
27
|
include Beaker::DSL::InstallUtils::ModuleUtils
|
28
|
+
|
29
|
+
include BeakerPuppet::Install::Puppet5
|
26
30
|
end
|
27
31
|
|
28
32
|
module Helpers
|
@@ -427,8 +427,9 @@ module Beaker
|
|
427
427
|
# by the caller; this can be used for additional
|
428
428
|
# validation, etc.
|
429
429
|
#
|
430
|
-
# @return [Array<Result>, Result, nil] An array of results, a result
|
431
|
-
# or nil. Check {#run_block_on} for
|
430
|
+
# @return [Array<Result>, Result, nil] An array of results, a result
|
431
|
+
# object, or nil. Check {Beaker::Shared::HostManager#run_block_on} for
|
432
|
+
# more details on this.
|
432
433
|
def apply_manifest_on(host, manifest, opts = {}, &block)
|
433
434
|
block_on host, opts do | host |
|
434
435
|
on_options = {}
|
@@ -972,9 +972,27 @@ module Beaker
|
|
972
972
|
repo_config_folder_url = "%s/%s/%s/repo_configs/%s/" %
|
973
973
|
[ buildserver_url, package_name, build_version, host.repo_type ]
|
974
974
|
|
975
|
-
|
976
|
-
|
977
|
-
|
975
|
+
repo_config_url = "#{ repo_config_folder_url }/#{ repo_filename }"
|
976
|
+
install_repo_configs_from_url( host, repo_config_url, copy_dir )
|
977
|
+
end
|
978
|
+
|
979
|
+
# Installs the repo configs on a given host
|
980
|
+
#
|
981
|
+
# @param [Beaker::Host] host Host to install configs on
|
982
|
+
# @param [String] repo_config_url URL to the repo configs
|
983
|
+
# @param [String] copy_dir Local directory to fetch files into & SCP out of
|
984
|
+
#
|
985
|
+
# @return nil
|
986
|
+
def install_repo_configs_from_url(host, repo_config_url, copy_dir = nil)
|
987
|
+
copy_dir ||= Dir.mktmpdir
|
988
|
+
repoconfig_filename = File.basename( repo_config_url )
|
989
|
+
repoconfig_folder = File.dirname( repo_config_url )
|
990
|
+
|
991
|
+
repo = fetch_http_file(
|
992
|
+
repoconfig_folder,
|
993
|
+
repoconfig_filename,
|
994
|
+
copy_dir
|
995
|
+
)
|
978
996
|
|
979
997
|
if host[:platform] =~ /cisco_nexus/
|
980
998
|
to_path = "#{host.package_config_dir}/#{File.basename(repo)}"
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'beaker/dsl/install_utils/foss_defaults'
|
2
|
+
|
3
|
+
module BeakerPuppet
|
4
|
+
module Install
|
5
|
+
module Puppet5
|
6
|
+
|
7
|
+
include Beaker::DSL::InstallUtils::FOSSDefaults
|
8
|
+
|
9
|
+
# grab build json from the builds server
|
10
|
+
#
|
11
|
+
# @param [String] sha_yaml_url URL to the <SHA>.yaml file containing the
|
12
|
+
# build details
|
13
|
+
#
|
14
|
+
# @return [Hash{String=>String}] build json parsed into a ruby hash
|
15
|
+
def fetch_build_details(sha_yaml_url)
|
16
|
+
dst_folder = Dir.mktmpdir
|
17
|
+
sha_yaml_filename = File.basename( sha_yaml_url )
|
18
|
+
sha_yaml_folder_url = File.dirname( sha_yaml_url )
|
19
|
+
|
20
|
+
sha_yaml_file_local_path = fetch_http_file(
|
21
|
+
sha_yaml_folder_url,
|
22
|
+
sha_yaml_filename,
|
23
|
+
dst_folder
|
24
|
+
)
|
25
|
+
file_hash = YAML.load_file( sha_yaml_file_local_path )
|
26
|
+
|
27
|
+
logger.debug("YAML HASH BELOW:")
|
28
|
+
logger.debug(file_hash)
|
29
|
+
logger.debug("PLATFORM_DATA BELOW:")
|
30
|
+
logger.debug(file_hash[:platform_data])
|
31
|
+
return sha_yaml_folder_url, file_hash[:platform_data]
|
32
|
+
end
|
33
|
+
|
34
|
+
# gets the artifact & repo_config URLs for this host in the build
|
35
|
+
#
|
36
|
+
# @param [Host] host Host to get artifact URL for
|
37
|
+
# @param [Hash] build_details Details of the build in a hash
|
38
|
+
# @param [String] build_url URL to the build
|
39
|
+
#
|
40
|
+
# @return [String, String] URL to the build artifact, URL to the repo_config
|
41
|
+
# (nil if there is no repo_config for this platform for this build)
|
42
|
+
def host_urls(host, build_details, build_url)
|
43
|
+
packaging_platform = host[:packaging_platform]
|
44
|
+
if packaging_platform.nil?
|
45
|
+
message = <<-EOF
|
46
|
+
:packaging_platform not provided for host '#{host}', platform '#{host[:platform]}'
|
47
|
+
:packaging_platform should be the platform-specific key from this list:
|
48
|
+
#{ build_details.keys }
|
49
|
+
EOF
|
50
|
+
fail_test( message )
|
51
|
+
end
|
52
|
+
|
53
|
+
logger.debug("Platforms available for this build:")
|
54
|
+
logger.debug("#{ build_details.keys }")
|
55
|
+
logger.debug("PLATFORM SPECIFIC INFO for #{host} (packaging name '#{packaging_platform}'):")
|
56
|
+
packaging_data = build_details[packaging_platform]
|
57
|
+
logger.debug("- #{ packaging_data }, isnil? #{ packaging_data.nil? }")
|
58
|
+
if packaging_data.nil?
|
59
|
+
message = <<-EOF
|
60
|
+
:packaging_platform '#{packaging_platform}' for host '#{host}' not in build details
|
61
|
+
:packaging_platform should be the platform-specific key from this list:
|
62
|
+
#{ build_details.keys }
|
63
|
+
EOF
|
64
|
+
fail_test( message )
|
65
|
+
end
|
66
|
+
|
67
|
+
artifact_buildserver_path = packaging_data[:artifact]
|
68
|
+
repoconfig_buildserver_path = packaging_data[:repo_config]
|
69
|
+
fail_test('no artifact_buildserver_path found') if artifact_buildserver_path.nil?
|
70
|
+
|
71
|
+
artifact_url = "#{build_url}/#{artifact_buildserver_path}"
|
72
|
+
repoconfig_url = "#{build_url}/#{repoconfig_buildserver_path}" unless repoconfig_buildserver_path.nil?
|
73
|
+
artifact_url_correct = link_exists?( artifact_url )
|
74
|
+
logger.debug("- artifact url: '#{artifact_url}'. Exists? #{artifact_url_correct}")
|
75
|
+
fail_test('artifact url built incorrectly') if !artifact_url_correct
|
76
|
+
|
77
|
+
return artifact_url, repoconfig_url
|
78
|
+
end
|
79
|
+
|
80
|
+
# install build artifact on the given host
|
81
|
+
#
|
82
|
+
# @param [Host] host Host to install artifact on
|
83
|
+
# @param [String] artifact_url URL of the project install artifact
|
84
|
+
# @param [String] project_name Name of project for artifact. Needed for OSX installs
|
85
|
+
#
|
86
|
+
# @return nil
|
87
|
+
def install_artifact_on(host, artifact_url, project_name)
|
88
|
+
variant, _, _, _ = host[:platform].to_array
|
89
|
+
onhost_package_file = nil
|
90
|
+
if variant == 'eos'
|
91
|
+
host.get_remote_file( artifact_url )
|
92
|
+
onhost_package_file = File.basename( artifact_url )
|
93
|
+
elsif variant == 'solaris'
|
94
|
+
artifact_filename = File.basename( artifact_url )
|
95
|
+
artifact_folder = File.dirname( artifact_url )
|
96
|
+
fetch_http_file( artifact_folder, artifact_filename, '.' )
|
97
|
+
onhost_package_dir = host.tmpdir( 'puppet_installer' )
|
98
|
+
scp_to host, artifact_filename, onhost_package_dir
|
99
|
+
onhost_package_file = "#{ onhost_package_dir }/#{ artifact_filename }"
|
100
|
+
elsif variant == 'osx'
|
101
|
+
on host, "curl -O #{ artifact_url }"
|
102
|
+
onhost_package_file = "#{ project_name }*"
|
103
|
+
end
|
104
|
+
|
105
|
+
if variant == 'eos'
|
106
|
+
# TODO Will be refactored into {Beaker::Host#install_local_package}
|
107
|
+
# immediately following this work. The release timing makes it
|
108
|
+
# necessary to have this here separately for a short while
|
109
|
+
host.install_from_file( onhost_package_file )
|
110
|
+
elsif onhost_package_file
|
111
|
+
if onhost_package_dir
|
112
|
+
host.install_local_package( onhost_package_file, '.' )
|
113
|
+
else
|
114
|
+
host.install_local_package( onhost_package_file )
|
115
|
+
end
|
116
|
+
else
|
117
|
+
host.install_package( artifact_url )
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Sets up the repo_configs on the host for this build
|
122
|
+
#
|
123
|
+
# @param [Host] host Host to install repo_configs on
|
124
|
+
# @param [String] repoconfig_url URL to the repo_config
|
125
|
+
#
|
126
|
+
# @return nil
|
127
|
+
def install_repo_configs_on(host, repoconfig_url)
|
128
|
+
if repoconfig_url.nil?
|
129
|
+
logger.warn("No repo_config for host '#{host}'. Skipping repo_config install")
|
130
|
+
return
|
131
|
+
end
|
132
|
+
|
133
|
+
install_repo_configs_from_url( host, repoconfig_url )
|
134
|
+
end
|
135
|
+
|
136
|
+
# Installs a specified puppet project on all hosts. Gets build information
|
137
|
+
# from the provided YAML file located at the +sha_yaml_url+ parameter.
|
138
|
+
#
|
139
|
+
# @param [String] project_name Name of the project to install
|
140
|
+
# @param [String] sha_yaml_url URL to the <SHA>.yaml file containing the
|
141
|
+
# build details
|
142
|
+
#
|
143
|
+
# @note This install method only works for Puppet versions >= 5.0
|
144
|
+
#
|
145
|
+
# @return nil
|
146
|
+
def install_from_build_data_url(project_name, sha_yaml_url)
|
147
|
+
if !link_exists?( sha_yaml_url )
|
148
|
+
message = <<-EOF
|
149
|
+
<SHA>.yaml URL '#{ sha_yaml_url }' does not exist.
|
150
|
+
Please update the `sha_yaml_url` parameter to the `puppet5_install` method.
|
151
|
+
EOF
|
152
|
+
fail_test( message )
|
153
|
+
end
|
154
|
+
|
155
|
+
base_url, build_details = fetch_build_details( sha_yaml_url )
|
156
|
+
hosts.each do |host|
|
157
|
+
artifact_url, repoconfig_url = host_urls( host, build_details, base_url )
|
158
|
+
if repoconfig_url.nil?
|
159
|
+
install_artifact_on( host, artifact_url, project_name )
|
160
|
+
else
|
161
|
+
install_repo_configs_on( host, repoconfig_url )
|
162
|
+
host.install_package( project_name )
|
163
|
+
end
|
164
|
+
configure_type_defaults_on( host )
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
@@ -0,0 +1,282 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ClassMixedWithDSLInstallUtils
|
4
|
+
include Beaker::DSL::Outcomes
|
5
|
+
include BeakerPuppet::Install::Puppet5
|
6
|
+
|
7
|
+
def logger
|
8
|
+
@logger ||= RSpec::Mocks::Double.new('logger').as_null_object
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ClassMixedWithDSLInstallUtils do
|
13
|
+
let(:hosts) { make_hosts( { :pe_ver => '3.0',
|
14
|
+
:platform => 'linux',
|
15
|
+
:roles => [ 'agent' ],
|
16
|
+
:type => 'foss' }, 4 ) }
|
17
|
+
|
18
|
+
before :each do
|
19
|
+
allow( subject ).to receive( :hosts ) { hosts }
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
describe '#fetch_build_details' do
|
24
|
+
let( :platform_data ) { @platform_data || '' }
|
25
|
+
let( :deets ) { { :platform_data => platform_data } }
|
26
|
+
|
27
|
+
it 'sets & returns the relative folder' do
|
28
|
+
sha_yaml_folder = '/jams/of/the/rain'
|
29
|
+
sha_yaml_url = "#{sha_yaml_folder}/puns.tgz"
|
30
|
+
expect( subject ).to receive( :fetch_http_file )
|
31
|
+
expect( YAML ).to receive( :load_file ) { deets }
|
32
|
+
|
33
|
+
url, _ = subject.fetch_build_details( sha_yaml_url )
|
34
|
+
expect( url ).to be === sha_yaml_folder
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'fetches & returns the build details' do
|
38
|
+
@platform_data = 'test of the man in the can carol?'
|
39
|
+
expect( subject ).to receive( :fetch_http_file )
|
40
|
+
expect( YAML ).to receive( :load_file ) { deets }
|
41
|
+
|
42
|
+
_, hash = subject.fetch_build_details( 'sha_yaml_url' )
|
43
|
+
expect( hash ).to be === @platform_data
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'stores the file in a good location' do
|
47
|
+
allow( YAML ).to receive( :load_file ) { deets }
|
48
|
+
|
49
|
+
correct_location = '/my/fake/test/dir'
|
50
|
+
expect( Dir ).to receive( :mktmpdir ) { correct_location }
|
51
|
+
expect( subject ).to receive( :fetch_http_file ).with(
|
52
|
+
anything, anything, correct_location
|
53
|
+
)
|
54
|
+
subject.fetch_build_details( 'sha_yaml_url' )
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#host_urls' do
|
60
|
+
|
61
|
+
let( :artifact_path ) { @artifact_path || '' }
|
62
|
+
let( :repo_config ) { @repo_config || nil }
|
63
|
+
let( :packaging_platform ) { @packaging_platform || 'el-7-x86_64' }
|
64
|
+
let( :host ) {
|
65
|
+
host = hosts[0]
|
66
|
+
allow( host ).to receive( :[] ).with( :packaging_platform ) {
|
67
|
+
packaging_platform
|
68
|
+
}
|
69
|
+
host
|
70
|
+
}
|
71
|
+
let( :build_details ) {
|
72
|
+
details = {
|
73
|
+
packaging_platform => {
|
74
|
+
:artifact => artifact_path,
|
75
|
+
:repo_config => repo_config
|
76
|
+
}
|
77
|
+
}
|
78
|
+
details
|
79
|
+
}
|
80
|
+
|
81
|
+
it 'fails if there\'s no artifact value for the given platform' do
|
82
|
+
allow( artifact_path ).to receive( :nil? ) { true }
|
83
|
+
expect {
|
84
|
+
subject.host_urls( host, build_details, '' )
|
85
|
+
}.to raise_error(
|
86
|
+
Beaker::DSL::Outcomes::FailTest,
|
87
|
+
/^no artifact.*path found$/
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'fails if the artifact_url doesn\'t exist' do
|
92
|
+
allow( subject ).to receive( :link_exists? ) { false }
|
93
|
+
expect {
|
94
|
+
subject.host_urls( host, build_details, '' )
|
95
|
+
}.to raise_error(
|
96
|
+
Beaker::DSL::Outcomes::FailTest,
|
97
|
+
/^artifact url.*incorrectly$/
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'fails if the host doesn\'t have a packaging_platform' do
|
102
|
+
allow( packaging_platform ).to receive( :nil? ) { true }
|
103
|
+
allow( host ).to receive( :[] ).with( :platform ) { 'fake-platform' }
|
104
|
+
expect {
|
105
|
+
subject.host_urls( host, build_details, '' )
|
106
|
+
}.to raise_error(
|
107
|
+
Beaker::DSL::Outcomes::FailTest,
|
108
|
+
/packaging_platform not provided for host/
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'returns a join of the base_url & the platform-specific artifact path' do
|
113
|
+
base_url = 'base_url/base_url'
|
114
|
+
@artifact_path = 'pants.install.pkg'
|
115
|
+
|
116
|
+
allow( subject ).to receive( :link_exists? ) { true }
|
117
|
+
artifact_url, _ = subject.host_urls( host, build_details, base_url )
|
118
|
+
expect( artifact_url ).to be === "#{base_url}/#{@artifact_path}"
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'returns a join of the base_url & the platform-specific artifact path' do
|
122
|
+
base_url = 'base_url/base_url'
|
123
|
+
@repo_config = 'pants.install.list'
|
124
|
+
|
125
|
+
allow( subject ).to receive( :link_exists? ) { true }
|
126
|
+
_, repoconfig_url = subject.host_urls( host, build_details, base_url )
|
127
|
+
expect( repoconfig_url ).to be === "#{base_url}/#{@repo_config}"
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'returns nil for the repoconfig_url if one isn\'t provided by the build_details' do
|
131
|
+
allow( subject ).to receive( :link_exists? ) { true }
|
132
|
+
_, repoconfig_url = subject.host_urls( host, build_details, '' )
|
133
|
+
expect( repoconfig_url ).to be_nil
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#install_artifact_on' do
|
139
|
+
|
140
|
+
let( :artifact_url ) { 'url://in/the/jungle/lies/the/prize.pnc' }
|
141
|
+
let( :platform ) { @platform || 'linux' }
|
142
|
+
let( :mock_platform ) {
|
143
|
+
mock_platform = Object.new
|
144
|
+
allow( mock_platform ).to receive( :to_array ) { [platform, '', '', ''] }
|
145
|
+
mock_platform
|
146
|
+
}
|
147
|
+
let( :host ) {
|
148
|
+
host = hosts[0]
|
149
|
+
allow( host ).to receive( :[] ).with( :platform ) { mock_platform }
|
150
|
+
host
|
151
|
+
}
|
152
|
+
|
153
|
+
it 'calls host.install_package in the common case' do
|
154
|
+
expect( subject ).to receive( :fetch_http_file ).never
|
155
|
+
expect( subject ).to receive( :on ).never
|
156
|
+
expect( host ).to receive( :install_local_package ).never
|
157
|
+
expect( host ).to receive( :install_package ).once
|
158
|
+
|
159
|
+
subject.install_artifact_on( host, artifact_url, 'project_name' )
|
160
|
+
end
|
161
|
+
|
162
|
+
context 'local install cases' do
|
163
|
+
|
164
|
+
def run_shared_test_steps
|
165
|
+
expect( host ).to receive( :install_local_package ).once
|
166
|
+
expect( host ).to receive( :install_package ).never
|
167
|
+
subject.install_artifact_on( host, artifact_url, 'project_name' )
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'SOLARIS: fetches the file & runs local install' do
|
171
|
+
@platform = 'solaris'
|
172
|
+
|
173
|
+
expect( subject ).to receive( :fetch_http_file ).once
|
174
|
+
expect( subject ).to receive( :scp_to ).once
|
175
|
+
run_shared_test_steps()
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'OSX: curls the file & runs local install' do
|
179
|
+
@platform = 'osx'
|
180
|
+
|
181
|
+
expect( subject ).to receive( :on ).with( host, /^curl.*#{artifact_url}$/ )
|
182
|
+
run_shared_test_steps()
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
describe '#install_repo_configs_on' do
|
190
|
+
let( :host ) { hosts[0] }
|
191
|
+
|
192
|
+
it 'passes the parameters through to #install_repo_configs_from_url' do
|
193
|
+
repoconfig_url = 'string/test/repo_config/stuff.stuff'
|
194
|
+
expect( subject ).to receive( :install_repo_configs_from_url ).with(
|
195
|
+
host,
|
196
|
+
repoconfig_url
|
197
|
+
)
|
198
|
+
expect( subject.logger ).to receive( :warn ).never
|
199
|
+
subject.install_repo_configs_on( host, repoconfig_url )
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'returns without calling #install_repo_configs_from_url if repoconfig_url is nil' do
|
203
|
+
expect( subject ).to receive( :install_repo_configs_from_url ).never
|
204
|
+
expect( subject.logger ).to receive( :warn ).with(
|
205
|
+
/^No repo_config.*Skipping repo_config install$/
|
206
|
+
)
|
207
|
+
subject.install_repo_configs_on( host, nil )
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#install_from_build_data_url' do
|
212
|
+
|
213
|
+
before :each do
|
214
|
+
allow( subject ).to receive( :link_exists? ) { true }
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'only calls #fetch_build_details once' do
|
218
|
+
allow( subject ).to receive( :host_urls )
|
219
|
+
allow( subject ).to receive( :install_artifact_on )
|
220
|
+
allow( subject ).to receive( :configure_type_defaults_on )
|
221
|
+
|
222
|
+
expect( subject ).to receive( :fetch_build_details ).once
|
223
|
+
subject.install_from_build_data_url( 'project_name', 'project_sha' )
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'calls #configure_type_defaults_on all hosts' do
|
227
|
+
allow( subject ).to receive( :fetch_build_details )
|
228
|
+
allow( subject ).to receive( :host_urls )
|
229
|
+
allow( subject ).to receive( :install_artifact_on )
|
230
|
+
|
231
|
+
hosts.each do |host|
|
232
|
+
expect( subject ).to receive( :configure_type_defaults_on ).with( host ).once
|
233
|
+
end
|
234
|
+
subject.install_from_build_data_url( 'project_name', 'project_sha' )
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'passes the artifact_url from #hosts_artifact_url to #install_artifact_on' do
|
238
|
+
allow( subject ).to receive( :fetch_build_details )
|
239
|
+
allow( subject ).to receive( :configure_type_defaults_on )
|
240
|
+
|
241
|
+
artifact_url = 'url://in/my/shoe/lies/the/trophy.jnk'
|
242
|
+
allow( subject ).to receive( :host_urls ) { artifact_url }
|
243
|
+
|
244
|
+
|
245
|
+
expect( subject ).to receive( :install_artifact_on ).with(
|
246
|
+
anything, artifact_url, anything
|
247
|
+
).exactly( hosts.length ).times
|
248
|
+
subject.install_from_build_data_url('project_name', 'project_sha' )
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'fails properly if the given sha_yaml_url doesn\'t exist' do
|
252
|
+
allow( subject ).to receive( :link_exists? ) { false }
|
253
|
+
sha_yaml_url = 'pants/to/the/man/jeans.txt'
|
254
|
+
|
255
|
+
expect {
|
256
|
+
subject.install_from_build_data_url( 'project_name', sha_yaml_url )
|
257
|
+
}.to raise_error(
|
258
|
+
Beaker::DSL::Outcomes::FailTest,
|
259
|
+
/#{sha_yaml_url}' does not exist/
|
260
|
+
)
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'runs host.install_package instead of #install_artifact_on if theres a repo_config' do
|
264
|
+
repoconfig_url = 'pants/man/shoot/to/the/stars'
|
265
|
+
project_name = 'fake_project_66'
|
266
|
+
allow( subject ).to receive( :fetch_build_details )
|
267
|
+
allow( subject ).to receive( :configure_type_defaults_on )
|
268
|
+
allow( subject ).to receive( :host_urls ) { ['', repoconfig_url] }
|
269
|
+
|
270
|
+
expect( subject ).to receive( :install_artifact_on ).never
|
271
|
+
hosts.each do |host|
|
272
|
+
expect( subject ).to receive( :install_repo_configs_on ).with(
|
273
|
+
host,
|
274
|
+
repoconfig_url
|
275
|
+
)
|
276
|
+
expect( host ).to receive( :install_package ).with( project_name )
|
277
|
+
end
|
278
|
+
subject.install_from_build_data_url( project_name, 'sha_yaml_url' )
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/beaker-puppet/install_utils/foss_defaults.rb
|
220
220
|
- lib/beaker-puppet/install_utils/foss_utils.rb
|
221
221
|
- lib/beaker-puppet/install_utils/module_utils.rb
|
222
|
+
- lib/beaker-puppet/install_utils/puppet5.rb
|
222
223
|
- lib/beaker-puppet/install_utils/puppet_utils.rb
|
223
224
|
- lib/beaker-puppet/version.rb
|
224
225
|
- lib/beaker-puppet/wrappers.rb
|
@@ -236,6 +237,7 @@ files:
|
|
236
237
|
- spec/beaker-puppet/helpers/tk_helpers_spec.rb
|
237
238
|
- spec/beaker-puppet/install_utils/foss_utils_spec.rb
|
238
239
|
- spec/beaker-puppet/install_utils/module_utils_spec.rb
|
240
|
+
- spec/beaker-puppet/install_utils/puppet5_spec.rb
|
239
241
|
- spec/beaker-puppet/install_utils/puppet_utils_spec.rb
|
240
242
|
- spec/helpers.rb
|
241
243
|
- spec/spec_helper.rb
|