beaker-module_install_helper 0.1.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Beaker::ModuleInstallHelper do
@@ -6,7 +8,7 @@ describe Beaker::ModuleInstallHelper do
6
8
  let(:hosts) do
7
9
  [
8
10
  { 'roles' => %w[master database dashboard classifier] },
9
- { 'roles' => ['agent'] }
11
+ { 'roles' => ['agent'] },
10
12
  ]
11
13
  end
12
14
 
@@ -71,24 +73,48 @@ describe Beaker::ModuleInstallHelper do
71
73
  let(:module_source_dir) { '/a/b/c/d' }
72
74
  let(:host) { { 'roles' => %w[master database dashboard classifier] } }
73
75
 
74
- before do
75
- $module_source_dir = '/a/b/c/d'
76
- allow(File).to receive(:exist?).and_return(true)
77
- allow(File).to receive(:read).and_return('{"name": "puppetlabs-vcsrepo"}')
78
-
79
- allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
80
- .to receive(:copy_module_to)
81
- .with(anything)
82
- .and_return(false)
76
+ context 'without options' do
77
+ before do
78
+ $module_source_dir = '/a/b/c/d'
79
+ allow(File).to receive(:exist?).and_return(true)
80
+ allow(File).to receive(:read).and_return('{"name": "puppetlabs-vcsrepo"}')
81
+
82
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
83
+ .to receive(:copy_module_to)
84
+ .with(anything)
85
+ .and_return(false)
86
+
87
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
88
+ .to receive(:copy_module_to)
89
+ .with(host, source: module_source_dir, module_name: 'vcsrepo')
90
+ .and_return(true)
91
+ end
83
92
 
84
- allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
85
- .to receive(:copy_module_to)
86
- .with(host, source: module_source_dir, module_name: 'vcsrepo')
87
- .and_return(true)
93
+ it 'copy module to given host' do
94
+ expect(install_module_on(host)).to be true
95
+ end
88
96
  end
89
97
 
90
- it 'copy module to given host' do
91
- expect(install_module_on(host)).to be true
98
+ context 'with options' do
99
+ before do
100
+ $module_source_dir = '/a/b/c/d'
101
+ allow(File).to receive(:exist?).and_return(true)
102
+ allow(File).to receive(:read).and_return('{"name": "puppetlabs-vcsrepo"}')
103
+
104
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
105
+ .to receive(:copy_module_to)
106
+ .with(anything)
107
+ .and_return(false)
108
+
109
+ allow_any_instance_of(Beaker::DSL::InstallUtils::ModuleUtils)
110
+ .to receive(:copy_module_to)
111
+ .with(host, source: module_source_dir, module_name: 'vcsrepo', protocol: 'rsync')
112
+ .and_return(true)
113
+ end
114
+
115
+ it 'copy module to given host' do
116
+ expect(install_module_on(host, protocol: 'rsync')).to be true
117
+ end
92
118
  end
93
119
  end
94
120
 
@@ -123,19 +149,19 @@ describe Beaker::ModuleInstallHelper do
123
149
  'dependencies' => [
124
150
  {
125
151
  'name' => 'puppetlabs/stdlib',
126
- 'version_requirement' => '>= 4.13.1 <= 4.14.0'
152
+ 'version_requirement' => '>= 4.13.1 <= 4.14.0',
127
153
  }, {
128
154
  'name' => 'puppetlabs/concat',
129
- 'version_requirement' => '>= 2.0.0 <= 2.2.0'
130
- }
131
- ]
155
+ 'version_requirement' => '>= 2.0.0 <= 2.2.0',
156
+ },
157
+ ],
132
158
  }
133
159
  end
134
160
 
135
161
  let(:desired) do
136
162
  [
137
163
  { module_name: 'puppetlabs-stdlib', version: '4.14.0' },
138
- { module_name: 'puppetlabs-concat', version: '2.2.0' }
164
+ { module_name: 'puppetlabs-concat', version: '2.2.0' },
139
165
  ]
140
166
  end
141
167
 
@@ -151,15 +177,15 @@ describe Beaker::ModuleInstallHelper do
151
177
  'name' => 'puppetlabs-vcsrepo',
152
178
  'dependencies' => [
153
179
  { 'name' => 'puppetlabs/stdlib' },
154
- { 'name' => 'puppetlabs/concat' }
155
- ]
180
+ { 'name' => 'puppetlabs/concat' },
181
+ ],
156
182
  }
157
183
  end
158
184
 
159
185
  let(:desired) do
160
186
  [
161
187
  { module_name: 'puppetlabs-stdlib' },
162
- { module_name: 'puppetlabs-concat' }
188
+ { module_name: 'puppetlabs-concat' },
163
189
  ]
164
190
  end
165
191
 
@@ -173,7 +199,7 @@ describe Beaker::ModuleInstallHelper do
173
199
  let(:input_metadata) do
174
200
  {
175
201
  'name' => 'puppetlabs-vcsrepo',
176
- 'dependencies' => []
202
+ 'dependencies' => [],
177
203
  }
178
204
  end
179
205
  let(:desired) { [] }
@@ -212,7 +238,7 @@ describe Beaker::ModuleInstallHelper do
212
238
  it 'return array with 2 gem version dependency objects' do
213
239
  res = version_requirements_from_string("#{lower_bound} #{upper_bound}")
214
240
  expect(res).to eql([Gem::Dependency.new('', lower_bound),
215
- Gem::Dependency.new('', upper_bound)])
241
+ Gem::Dependency.new('', upper_bound),])
216
242
  end
217
243
  end
218
244
  end
@@ -273,9 +299,9 @@ describe Beaker::ModuleInstallHelper do
273
299
  'dependencies' => [
274
300
  {
275
301
  'name' => 'puppetlabs/stdlib',
276
- 'version_requirement' => '>= 4.13.1 <= 4.14.0'
277
- }
278
- ]
302
+ 'version_requirement' => '>= 4.13.1 <= 4.14.0',
303
+ },
304
+ ],
279
305
  }
280
306
  end
281
307
 
@@ -295,8 +321,8 @@ describe Beaker::ModuleInstallHelper do
295
321
  'name' => 'puppetlabs-vcsrepo',
296
322
  'dependencies' => [
297
323
  { 'name' => 'puppetlabs/stdlib' },
298
- { 'name' => 'puppetlabs/concat' }
299
- ]
324
+ { 'name' => 'puppetlabs/concat' },
325
+ ],
300
326
  }
301
327
  end
302
328
  let(:a_host) { { name: 'a_host' } }
@@ -334,4 +360,29 @@ describe Beaker::ModuleInstallHelper do
334
360
  install_module_from_forge_on(a_host, input_module_name, input_module_version_requirement)
335
361
  end
336
362
  end
363
+
364
+ describe 'module_version_from_requirement' do
365
+ context 'when looking up resolvable version contraints for a valid module' do
366
+ it 'gets a response', live_fire: true do
367
+ ver = module_version_from_requirement('puppetlabs-vcsrepo', '>= 1 < 2')
368
+ expect(ver).to eq '1.5.0'
369
+ end
370
+ end
371
+
372
+ context 'when looking up *unresolvable* version contraints for a valid module' do
373
+ it 'gets a response', live_fire: true do
374
+ expect do
375
+ module_version_from_requirement('puppetlabs-vcsrepo', '> 1.4 < 1.5')
376
+ end.to raise_error(/^No release version found matching 'puppetlabs-vcsrepo' '> 1.4 < 1.5'/)
377
+ end
378
+ end
379
+
380
+ context 'when looking up metadata for a *invalid* module name' do
381
+ it 'gets a response', live_fire: true do
382
+ expect do
383
+ module_version_from_requirement('puppet-does-not-exist', '>= 1 < 2')
384
+ end.to raise_error(/^Puppetforge API error/)
385
+ end
386
+ end
387
+ end
337
388
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker-module_install_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Puppet
7
+ - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.12'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '3.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: voxpupuli-rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: beaker
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +45,9 @@ dependencies:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '2.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '6'
34
51
  type: :runtime
35
52
  prerelease: false
36
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,29 +55,54 @@ dependencies:
38
55
  - - ">="
39
56
  - !ruby/object:Gem::Version
40
57
  version: '2.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '6'
61
+ - !ruby/object:Gem::Dependency
62
+ name: beaker-puppet
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '1'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '3'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '1'
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '3'
41
81
  description: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
42
82
  to help install the module under test and its dependencies on the system under test
43
83
  email:
44
- - wilson@puppet.com
84
+ - voxpupuli@groups.io
45
85
  executables: []
46
86
  extensions: []
47
87
  extra_rdoc_files: []
48
88
  files:
89
+ - ".github/dependabot.yml"
90
+ - ".github/workflows/release.yml"
91
+ - ".github/workflows/test.yml"
49
92
  - ".gitignore"
50
93
  - ".rubocop.yml"
51
- - ".travis.yml"
94
+ - ".rubocop_todo.yml"
52
95
  - CHANGELOG.md
53
96
  - CONTRIBUTING.md
54
97
  - Gemfile
55
98
  - LICENSE
56
- - MAINTAINERS
57
99
  - README.md
58
100
  - Rakefile
59
101
  - beaker-module_install_helper.gemspec
60
102
  - lib/beaker/module_install_helper.rb
61
103
  - spec/spec_helper.rb
62
104
  - spec/unit/beaker/module_install_helper_spec.rb
63
- homepage: https://github.com/puppetlabs/beaker-module_install_helper
105
+ homepage: https://github.com/voxpupuli/beaker-module_install_helper
64
106
  licenses:
65
107
  - Apache-2.0
66
108
  metadata: {}
@@ -72,18 +114,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - ">="
74
116
  - !ruby/object:Gem::Version
75
- version: '0'
117
+ version: 2.7.0
76
118
  required_rubygems_version: !ruby/object:Gem::Requirement
77
119
  requirements:
78
120
  - - ">="
79
121
  - !ruby/object:Gem::Version
80
122
  version: '0'
81
123
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.6.8
124
+ rubygems_version: 3.2.33
84
125
  signing_key:
85
126
  specification_version: 4
86
127
  summary: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
87
- test_files:
88
- - spec/spec_helper.rb
89
- - spec/unit/beaker/module_install_helper_spec.rb
128
+ test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
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/MAINTAINERS DELETED
@@ -1,11 +0,0 @@
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
- }