beaker-module_install_helper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1a5d53299f555a39466b8de21cb35006475c29c
4
+ data.tar.gz: c636a1beb7956aee0a2f169e176d683e6c3d1f2d
5
+ SHA512:
6
+ metadata.gz: e6cbf3cc5e7c67da196b3e65ca8076f1b71c5cee693eb7c4b2f05a499382d7262e3f68f4b3302ff1e45d7ba22117fca86eb570bfdb80b8417ef430c0d69727dd
7
+ data.tar.gz: a0b526e752430e0dbf37d2c92947a751781b0af24c830110488a4b54a0afc491808e3a79fef3e439a50b9fdef65483894cf51052114502e09326ade80fb5a12d
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
data/.rubocop.yml ADDED
@@ -0,0 +1,31 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.1
5
+
6
+ RSpec/AnyInstance:
7
+ Enabled: false
8
+
9
+ RSpec/DescribeClass:
10
+ Enabled: false
11
+
12
+ RSpec/NestedGroups:
13
+ Enabled: false
14
+
15
+ Lint/AmbiguousRegexpLiteral:
16
+ Enabled: false
17
+
18
+ Style/ClassAndModuleChildren:
19
+ Enabled: false
20
+
21
+ Bundler/DuplicatedGem:
22
+ Enabled: false
23
+
24
+ Metrics/AbcSize:
25
+ Enabled: false
26
+
27
+ Metrics/LineLength:
28
+ Max: 100
29
+
30
+ Metrics/MethodLength:
31
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ script:
3
+ - bundle exec rake lint spec
4
+ notifications:
5
+ email: false
6
+ rvm:
7
+ - 2.1.6
8
+ - 2.3.0
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,5 @@
1
+ ### Contributing and adding features
2
+
3
+ This package is currently being developed so any contributions are welcomed. The purpose of this package is to simplify the spec_helper_acceptance.rb files within each module and as such any contributions in this area are welcome, as long as backwards compatibility is kept in mind.
4
+
5
+ Use this repo's issue tracker to track any issues you encounter
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'beaker', '= 2.52.0' if RUBY_VERSION <= '2.1.6'
7
+ gem 'beaker' if RUBY_VERSION > '2.1.6'
8
+ gem 'bundler', '~> 1.9'
9
+ gem 'rake', '~> 10.0'
10
+ gem 'rspec', '~> 3'
11
+ gem 'rubocop', require: false
12
+ gem 'rubocop-rspec', require: false
13
+ end
14
+
15
+ group :development do
16
+ gem 'pry'
17
+ gem 'pry-byebug'
18
+ end
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Copyright (C) 2015 Puppet Labs Inc
2
+
3
+ Puppet Labs can be contacted at: info@puppetlabs.com
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/MAINTAINERS ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 1,
3
+ "file_format": "This MAINTAINERS file format is described at http://pup.pt/maintainers",
4
+ "issues": "https://github.com/puppetlabs/beaker-module_install_helper/issues",
5
+ "people": [
6
+ {
7
+ "github": "wilson208",
8
+ "name": "Wilson McCoubrey"
9
+ }
10
+ ]
11
+ }
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ ## beaker-module\_install\_helper
2
+
3
+ This gem is simply an abstraction for the various functions that are performed within the `spec/spec_helper_acceptance.rb` files across the modules to standardise how these are implemented.
4
+
5
+ ### Usage
6
+ The below example will install the module from source on the host with role 'master', if that doesn't exist, on all hosts with role 'agent'. Otherwise it will be installed on all hosts.
7
+ ```ruby
8
+ require 'beaker/module_install_helper'
9
+ install_module_dependencies
10
+ install_module
11
+ ```
12
+
13
+ The below example will install the module from source on the specified host and install module dependencies specified in metadata.json on the host
14
+ ```ruby
15
+ require 'beaker/module_install_helper'
16
+ install_module_dependencies_on(host)
17
+ install_module_on(host)
18
+ ```
19
+
20
+ ### Assumptions
21
+ * Module under test has a valid metadata.json file at the root of the module directory.
22
+
23
+ ### `install_module`
24
+ This will call `install_module_on` on the hosts with role 'master'. If there are none, the module will be install on all hosts with the role 'agent', again, if there are none, the module will be installed on all hosts.
25
+
26
+ ### `install_module_on(host)`
27
+ This will install the module under test on the specified host using the local source. The module name will be derived from the name property of the module's metadata.json file, assuming it is in format author-modulename.
28
+
29
+ ### `install_module_dependencies`
30
+ This will call `install_module_dependencies_on` on the hosts with role 'master'. If there are none, the module will be install on all hosts with the role 'agent', again, if there are none, the module dependencies will be installed on all hosts.
31
+
32
+ ### `install_module_dependencies_on`
33
+ This will install a list of dependencies on the specified host from the forge, using the dependencies list specified in the metadata.json file, taking into consideration the version constraints if specified.
34
+
35
+ ### Support
36
+ No support is supplied or implied. Use at your own risk.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: [:lint, :spec]
3
+
4
+ require 'rubocop/rake_task'
5
+ desc 'Run rubocop'
6
+ RuboCop::RakeTask.new(:lint) do |t|
7
+ t.requires << 'rubocop-rspec'
8
+ end
9
+
10
+ require 'rspec/core/rake_task'
11
+ desc 'Run spec tests using rspec'
12
+ RSpec::Core::RakeTask.new(:spec) do |t|
13
+ t.rspec_opts = ['--color']
14
+ t.pattern = 'spec'
15
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'beaker-module_install_helper'
7
+ spec.version = '0.1.0'
8
+ spec.authors = ['Puppet']
9
+ spec.email = ['wilson@puppet.com']
10
+
11
+ spec.summary = 'A helper gem for use in a Puppet Modules ' \
12
+ 'spec_helper_acceptance.rb file'
13
+ spec.description = 'A helper gem for use in a Puppet Modules ' \
14
+ 'spec_helper_acceptance.rb file to help install the ' \
15
+ 'module under test and its dependencies on the system ' \
16
+ 'under test'
17
+ spec.homepage = 'https://github.com/puppetlabs/beaker-module_install_helper'
18
+ spec.license = 'Apache-2'
19
+
20
+ spec.files = `git ls-files`.split("\n")
21
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ spec.executables = `git ls-files -- bin/*` \
23
+ .split("\n") \
24
+ .map { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ ## Testing dependencies
28
+ spec.add_development_dependency 'rspec'
29
+
30
+ # Run time dependencies
31
+ spec.add_runtime_dependency 'beaker', '>= 2.0'
32
+ end
@@ -0,0 +1,150 @@
1
+ require 'beaker'
2
+
3
+ # Provides method for use in module test setup to install the module under
4
+ # test and it's dependencies on the specified hosts
5
+ module Beaker::ModuleInstallHelper
6
+ include Beaker::DSL
7
+
8
+ # This method calls the install_module_on method for each host which is a
9
+ # master, or if no master is present, on all agent nodes.
10
+ def install_module
11
+ install_module_on hosts_to_install_module_on
12
+ end
13
+
14
+ # This method will install the module under test on the specified host(s) from
15
+ # the source on the local machine
16
+ def install_module_on(host)
17
+ copy_module_to(host,
18
+ source: @module_source_dir,
19
+ module_name: module_name_from_metadata)
20
+ end
21
+
22
+ # This method calls the install_module_dependencies_on method for each
23
+ # host which is a master, or if no master is present, on all agent nodes.
24
+ def install_module_dependencies
25
+ hosts_to_install_module_on.each do |host|
26
+ install_module_dependencies_on(host)
27
+ end
28
+ end
29
+
30
+ # This method will install the module under tests module dependencies on the
31
+ # specified host from the dependencies list in metadata.json
32
+ def install_module_dependencies_on(host)
33
+ deps = module_dependencies_from_metadata
34
+ deps.each do |dep|
35
+ install_puppet_module_via_pmt_on(host, dep)
36
+ end
37
+ end
38
+
39
+ # This method returns an array of dependencies from the metadata.json file
40
+ # in the format of an array of hashes, containing :module_name and optionally
41
+ # :version elements. If no dependencies are specified, empty array is returned
42
+ def module_dependencies_from_metadata
43
+ metadata = module_metadata
44
+ return [] unless metadata.key?('dependencies')
45
+
46
+ dependencies = []
47
+ metadata['dependencies'].each do |d|
48
+ tmp = { module_name: d['name'].sub!('/', '-') }
49
+
50
+ if d.key?('version_requirement')
51
+ tmp[:version] = module_version_from_requirement(tmp[:module_name],
52
+ d['version_requirement'])
53
+ end
54
+ dependencies.push(tmp)
55
+ end
56
+
57
+ dependencies
58
+ end
59
+
60
+ # This method takes a module name and the version requirement string from the
61
+ # metadata.json file, containing either lower bounds of version or both lower
62
+ # and upper bounds. The function then uses the forge rest endpoint to find
63
+ # the most recent release of the given module matching the version requirement
64
+ def module_version_from_requirement(mod_name, vr_str)
65
+ uri = URI("https://forgeapi.puppetlabs.com/v3/modules/#{mod_name}")
66
+ response = Net::HTTP.get(uri)
67
+ forge_data = JSON.parse(response)
68
+
69
+ vrs = version_requirements_from_string(vr_str)
70
+
71
+ # Here we iterate the releases of the given module and pick the most recent
72
+ # that matches to version requirement
73
+ forge_data['releases'].sort_by { |k| k['version'] }.reverse.each do |rel|
74
+ return rel['version'] if vrs.all? { |vr| vr.match?('', rel['version']) }
75
+ end
76
+
77
+ raise "No release version found matching '#{vr}'"
78
+ end
79
+
80
+ # This method takes a version requirement string as specified in the link
81
+ # below, with either simply a lower bound, or both lower and upper bounds and
82
+ # returns an array of Gem::Dependency objects
83
+ # https://docs.puppet.com/puppet/latest/modules_metadata.html
84
+ def version_requirements_from_string(vr_str)
85
+ ops = vr_str.scan(/[(<|>|=)]{1,2}/i)
86
+ vers = vr_str.scan(/[(0-9|\.)]+/i)
87
+
88
+ raise 'Invalid version requirements' if ops.count != 0 &&
89
+ ops.count != vers.count
90
+
91
+ vrs = []
92
+ ops.each_with_index do |op, index|
93
+ vrs.push(Gem::Dependency.new('', "#{op} #{vers[index]}"))
94
+ end
95
+
96
+ vrs
97
+ end
98
+
99
+ # This method will return array of all masters. If no masters exist, it will
100
+ # return all agent nodes. If no nodes tagged master or agent exist, all nodes
101
+ # will be returned
102
+ def hosts_to_install_module_on
103
+ masters = hosts_with_role(hosts, :master)
104
+ return masters unless masters.empty?
105
+
106
+ agents = hosts_with_role(hosts, :agent)
107
+ return agents unless agents.empty?
108
+
109
+ hosts
110
+ end
111
+
112
+ # This method will read the 'name' attribute from metadata.json file and
113
+ # remove the first segment. E.g. puppetlabs-vcsrepo -> vcsrepo
114
+ def module_name_from_metadata
115
+ res = get_module_name module_metadata['name']
116
+ raise 'Error getting module name' unless res
117
+ res[1]
118
+ end
119
+
120
+ # This method uses the module_source_directory path to read the metadata.json
121
+ # file into a json array
122
+ def module_metadata
123
+ metadata_path = "#{@module_source_dir}/metadata.json"
124
+ unless File.exist?(metadata_path)
125
+ raise "Error loading metadata.json file from #{@module_source_dir}"
126
+ end
127
+ JSON.parse(File.read(metadata_path))
128
+ end
129
+
130
+ # Use this property to store the module_source_dir, so we don't traverse
131
+ # the tree every time
132
+ def get_module_source_directory(search_in)
133
+ module_source_dir = nil
134
+ # here we go up the file tree and search the directories for a
135
+ # valid metadata.json
136
+ while module_source_dir.nil? && search_in != File.dirname(search_in)
137
+ # remove last segment (file or folder, doesn't matter)
138
+ search_in = File.dirname(search_in)
139
+
140
+ # Append metadata.json, check it exists in the directory we're searching
141
+ metadata_path = File.join(search_in, 'metadata.json')
142
+ module_source_dir = search_in if File.exist?(metadata_path)
143
+ end
144
+ module_source_dir
145
+ end
146
+ end
147
+
148
+ include Beaker::ModuleInstallHelper
149
+ # Use the caller (requirer) of this file to begin search for module source dir
150
+ @module_source_dir = get_module_source_directory caller[0][/[^:]+/]
@@ -0,0 +1 @@
1
+ require 'beaker/module_install_helper'
@@ -0,0 +1,288 @@
1
+ require 'spec_helper'
2
+
3
+ describe Beaker::ModuleInstallHelper do
4
+ context 'hosts_to_install_module_on' do
5
+ context 'on split master/agent setup' do
6
+ let(:hosts) do
7
+ [
8
+ { 'roles' => %w(master database dashboard classifier) },
9
+ { 'roles' => ['agent'] }
10
+ ]
11
+ end
12
+
13
+ it 'returns a node with master role' do
14
+ expect(hosts_to_install_module_on.first['roles']).to include 'master'
15
+ end
16
+ end
17
+
18
+ context 'on split agent only setup' do
19
+ let(:hosts) { [{ 'roles' => ['agent'] }] }
20
+
21
+ it 'returns a node with master role' do
22
+ expect(hosts_to_install_module_on.first['roles']).to include 'agent'
23
+ end
24
+ end
25
+ end
26
+
27
+ context 'module_name_from_metadata' do
28
+ let(:module_metadata) { { 'name' => 'puppetlabs-vcsrepo' } }
29
+
30
+ it 'Removes author from name' do
31
+ res = module_name_from_metadata
32
+ expect(res).to eq('vcsrepo')
33
+ end
34
+ end
35
+
36
+ context 'module_metadata' do
37
+ before do
38
+ @module_source_dir = '/a/b/c/d'
39
+ allow(File).to receive(:exist?)
40
+ .with('/a/b/c/d/metadata.json')
41
+ .and_return(true)
42
+ allow(File).to receive(:read)
43
+ .with('/a/b/c/d/metadata.json')
44
+ .and_return('{"name": "puppetlabs-vcsrepo"}')
45
+ end
46
+
47
+ it 'Returns hash with correct data' do
48
+ expect(module_metadata['name']).to eq('puppetlabs-vcsrepo')
49
+ end
50
+ end
51
+
52
+ context 'get_module_source_directory' do
53
+ let(:search_in) { '/a/b/c/d/e/f/g/h.rb' }
54
+ let(:search_in_no_metadata) { '/test/test/test/blah.rb' }
55
+
56
+ before do
57
+ allow(File).to receive(:exist?).with(anything).and_return(false)
58
+ allow(File).to receive(:exist?).with('/a/metadata.json').and_return(true)
59
+ end
60
+
61
+ it 'traverses file tree until it finds a folder containing metadata.json' do
62
+ expect(get_module_source_directory(search_in)).to eq('/a')
63
+ end
64
+
65
+ it 'traverses file tree without a metadata.json file' do
66
+ expect(get_module_source_directory(search_in_no_metadata)).to be_nil
67
+ end
68
+ end
69
+
70
+ context 'install_module_on' do
71
+ let(:module_source_dir) { '/a/b/c/d' }
72
+
73
+ before do
74
+ @module_source_dir = '/a/b/c/d'
75
+ allow(File).to receive(:exist?).and_return(true)
76
+ allow(File).to receive(:read).and_return('{"name": "puppetlabs-vcsrepo"}')
77
+
78
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
79
+ .to receive(:copy_module_to)
80
+ .with(anything)
81
+ .and_return(false)
82
+
83
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
84
+ .to receive(:copy_module_to)
85
+ .with(host, source: module_source_dir, module_name: 'vcsrepo')
86
+ .and_return(true)
87
+ end
88
+
89
+ let(:host) { { 'roles' => %w(master database dashboard classifier) } }
90
+
91
+ it 'copy module to given host' do
92
+ expect(install_module_on(host)).to be true
93
+ end
94
+ end
95
+
96
+ context 'module_version_matching_requirement' do
97
+ context 'with simple version requirement, no upper bound' do
98
+ it 'return latest matching version' do
99
+ res = module_version_from_requirement('puppetlabs-ntp', '= 6.0.0')
100
+ expect(res).to eql('6.0.0')
101
+ end
102
+ end
103
+
104
+ context 'with version range requirement with an upper bound' do
105
+ it 'return latest matching version' do
106
+ res = module_version_from_requirement('puppetlabs-ntp',
107
+ '>= 4.0.0 < 6.0.0')
108
+ expect(res).to eql('5.0.0')
109
+ end
110
+ end
111
+ end
112
+
113
+ context 'module_dependencies_from_metadata' do
114
+ before do
115
+ allow_any_instance_of(described_class)
116
+ .to receive(:module_metadata)
117
+ .and_return(input_metadata)
118
+ end
119
+
120
+ context 'multiple dependencies with versions' do
121
+ let(:input_metadata) do
122
+ {
123
+ 'name' => 'puppetlabs-vcsrepo',
124
+ 'dependencies' => [
125
+ {
126
+ 'name' => 'puppetlabs/stdlib',
127
+ 'version_requirement' => '>= 4.13.1 <= 4.14.0'
128
+ }, {
129
+ 'name' => 'puppetlabs/concat',
130
+ 'version_requirement' => '>= 2.0.0 <= 2.2.0'
131
+ }
132
+ ]
133
+ }
134
+ end
135
+
136
+ let(:desired) do
137
+ [
138
+ { module_name: 'puppetlabs-stdlib', version: '4.14.0' },
139
+ { module_name: 'puppetlabs-concat', version: '2.2.0' }
140
+ ]
141
+ end
142
+
143
+ it 'returns dependencies array with 2 dependencies and their versions' do
144
+ dependencies = module_dependencies_from_metadata
145
+ expect(dependencies).to eq(desired)
146
+ end
147
+ end
148
+
149
+ context 'multiple dependencies without versions' do
150
+ let(:input_metadata) do
151
+ {
152
+ 'name' => 'puppetlabs-vcsrepo',
153
+ 'dependencies' => [
154
+ { 'name' => 'puppetlabs/stdlib' },
155
+ { 'name' => 'puppetlabs/concat' }
156
+ ]
157
+ }
158
+ end
159
+
160
+ let(:desired) do
161
+ [
162
+ { module_name: 'puppetlabs-stdlib' },
163
+ { module_name: 'puppetlabs-concat' }
164
+ ]
165
+ end
166
+
167
+ it 'returns dependencies array with 2 dependencies without version' do
168
+ dependencies = module_dependencies_from_metadata
169
+ expect(dependencies).to eq(desired)
170
+ end
171
+ end
172
+
173
+ context 'empty dependencies' do
174
+ let(:input_metadata) do
175
+ {
176
+ 'name' => 'puppetlabs-vcsrepo',
177
+ 'dependencies' => []
178
+ }
179
+ end
180
+ let(:desired) { [] }
181
+
182
+ it 'returns empty dependencies array' do
183
+ dependencies = module_dependencies_from_metadata
184
+ expect(dependencies).to eq(desired)
185
+ end
186
+ end
187
+
188
+ context 'no dependencies' do
189
+ let(:input_metadata) { { 'name' => 'puppetlabs-vcsrepo' } }
190
+ let(:desired) { [] }
191
+
192
+ it 'returns empty dependencies array' do
193
+ dependencies = module_dependencies_from_metadata
194
+ expect(dependencies).to eq(desired)
195
+ end
196
+ end
197
+ end
198
+
199
+ context 'version_requirements_from_string' do
200
+ context 'with simple version requirement containing lower bound' do
201
+ let(:lower_bound) { '>= 2.0.0' }
202
+
203
+ it 'return array with single gem version dependency objects' do
204
+ res = version_requirements_from_string(lower_bound)
205
+ expect(res).to eql([Gem::Dependency.new('', lower_bound)])
206
+ end
207
+ end
208
+
209
+ context 'with complex version requirement containing upper bounds' do
210
+ let(:lower_bound) { '>= 2.0.0' }
211
+ let(:upper_bound) { '< 3.0.0' }
212
+
213
+ it 'return array with 2 gem version dependency objects' do
214
+ res = version_requirements_from_string("#{lower_bound} #{upper_bound}")
215
+ expect(res).to eql([Gem::Dependency.new('', lower_bound),
216
+ Gem::Dependency.new('', upper_bound)])
217
+ end
218
+ end
219
+ end
220
+
221
+ context 'install_module_dependencies_on' do
222
+ before do
223
+ allow_any_instance_of(described_class)
224
+ .to receive(:module_metadata)
225
+ .and_return(input_metadata)
226
+ end
227
+
228
+ context 'with 1 dependencies with version' do
229
+ let(:a_host) { { name: 'a_host' } }
230
+ let(:dependency) do
231
+ { module_name: 'puppetlabs-stdlib', version: '4.14.0' }
232
+ end
233
+ let(:input_metadata) do
234
+ {
235
+ 'name' => 'puppetlabs-vcsrepo',
236
+ 'dependencies' => [
237
+ {
238
+ 'name' => 'puppetlabs/stdlib',
239
+ 'version_requirement' => '>= 4.13.1 <= 4.14.0'
240
+ }
241
+ ]
242
+ }
243
+ end
244
+
245
+ before do
246
+ expect_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
247
+ .to receive(:install_puppet_module_via_pmt_on)
248
+ .with(a_host, dependency)
249
+ .exactly(1)
250
+ end
251
+
252
+ it 'installs the modules' do
253
+ install_module_dependencies_on(a_host)
254
+ end
255
+ end
256
+
257
+ context 'with 2 dependencies without version' do
258
+ let(:input_metadata) do
259
+ {
260
+ 'name' => 'puppetlabs-vcsrepo',
261
+ 'dependencies' => [
262
+ { 'name' => 'puppetlabs/stdlib' },
263
+ { 'name' => 'puppetlabs/concat' }
264
+ ]
265
+ }
266
+ end
267
+ let(:a_host) { { name: 'a_host' } }
268
+ let(:dependency1) { { module_name: 'puppetlabs-concat' } }
269
+ let(:dependency2) { { module_name: 'puppetlabs-stdlib' } }
270
+
271
+ before do
272
+ expect_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
273
+ .to receive(:install_puppet_module_via_pmt_on)
274
+ .with(a_host, dependency1)
275
+ .exactly(1)
276
+
277
+ expect_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
278
+ .to receive(:install_puppet_module_via_pmt_on)
279
+ .with(a_host, dependency2)
280
+ .exactly(1)
281
+ end
282
+
283
+ it 'installs both modules' do
284
+ install_module_dependencies_on(a_host)
285
+ end
286
+ end
287
+ end
288
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beaker-module_install_helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Puppet
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: beaker
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ description: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
42
+ to help install the module under test and its dependencies on the system under test
43
+ email:
44
+ - wilson@puppet.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".rubocop.yml"
51
+ - ".travis.yml"
52
+ - CONTRIBUTING.md
53
+ - Gemfile
54
+ - LICENSE
55
+ - MAINTAINERS
56
+ - README.md
57
+ - Rakefile
58
+ - beaker-module_install_helper.gemspec
59
+ - lib/beaker/module_install_helper.rb
60
+ - spec/spec_helper.rb
61
+ - spec/unit/beaker/module_install_helper_spec.rb
62
+ homepage: https://github.com/puppetlabs/beaker-module_install_helper
63
+ licenses:
64
+ - Apache-2
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.5.1
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
86
+ test_files:
87
+ - spec/spec_helper.rb
88
+ - spec/unit/beaker/module_install_helper_spec.rb