beaker-puppet 1.29.0 → 2.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/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +28 -7
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +842 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +5 -20
- data/Rakefile +64 -169
- data/acceptance/config/acceptance-options.rb +3 -3
- data/acceptance/config/gem/acceptance-options.rb +8 -8
- data/acceptance/config/git/acceptance-options.rb +8 -8
- data/acceptance/config/pkg/acceptance-options.rb +7 -7
- data/acceptance/pre_suite/gem/install.rb +6 -6
- data/acceptance/pre_suite/git/install.rb +22 -22
- data/acceptance/pre_suite/pkg/install.rb +3 -3
- data/acceptance/tests/backwards_compatible.rb +6 -7
- data/acceptance/tests/clone_git_repo_on_test.rb +12 -13
- data/acceptance/tests/create_tmpdir_on_test.rb +13 -9
- data/acceptance/tests/install_smoke_test.rb +5 -4
- data/acceptance/tests/stub_host.rb +11 -10
- data/acceptance/tests/web_helpers_test.rb +11 -10
- data/beaker-puppet.gemspec +16 -23
- data/bin/beaker-puppet +2 -4
- data/lib/beaker-puppet/helpers/facter_helpers.rb +9 -7
- data/lib/beaker-puppet/helpers/host_helpers.rb +10 -7
- data/lib/beaker-puppet/helpers/puppet_helpers.rb +151 -160
- data/lib/beaker-puppet/helpers/rake_helpers.rb +1 -1
- data/lib/beaker-puppet/helpers/tk_helpers.rb +22 -28
- data/lib/beaker-puppet/install_utils/aio_defaults.rb +39 -43
- data/lib/beaker-puppet/install_utils/ezbake_utils.rb +34 -42
- data/lib/beaker-puppet/install_utils/foss_defaults.rb +134 -138
- data/lib/beaker-puppet/install_utils/foss_utils.rb +293 -320
- data/lib/beaker-puppet/install_utils/module_utils.rb +58 -70
- data/lib/beaker-puppet/install_utils/puppet5.rb +30 -35
- data/lib/beaker-puppet/install_utils/puppet_utils.rb +58 -68
- data/lib/beaker-puppet/install_utils/windows_utils.rb +34 -36
- data/lib/beaker-puppet/version.rb +1 -1
- data/lib/beaker-puppet/wrappers.rb +13 -14
- data/lib/beaker-puppet.rb +4 -5
- data/setup/aio/010_Install_Puppet_Agent.rb +5 -6
- data/setup/common/000-delete-puppet-when-none.rb +2 -4
- data/setup/common/003_solaris_cert_fix.rb +74 -70
- data/setup/common/005_redhat_subscription_fix.rb +3 -2
- data/setup/common/011_Install_Puppet_Server.rb +7 -9
- data/setup/common/012_Finalize_Installs.rb +5 -5
- data/setup/common/025_StopFirewall.rb +1 -1
- data/setup/common/030_StopSssd.rb +2 -2
- data/setup/common/040_ValidateSignCert.rb +10 -12
- data/setup/common/045_EnsureMasterStarted.rb +2 -2
- data/setup/gem/010_GemInstall.rb +5 -4
- data/setup/git/000_EnvSetup.rb +48 -48
- data/setup/git/010_TestSetup.rb +13 -12
- data/setup/git/020_PuppetUserAndGroup.rb +3 -2
- data/setup/git/060_InstallModules.rb +14 -14
- data/setup/git/070_InstallCACerts.rb +82 -82
- data/spec/beaker-puppet/helpers/facter_helpers_spec.rb +22 -24
- data/spec/beaker-puppet/helpers/host_helpers_spec.rb +10 -6
- data/spec/beaker-puppet/helpers/puppet_helpers_spec.rb +506 -517
- data/spec/beaker-puppet/helpers/tk_helpers_spec.rb +20 -24
- data/spec/beaker-puppet/install_utils/ezbake_utils_spec.rb +86 -90
- data/spec/beaker-puppet/install_utils/foss_utils_spec.rb +636 -599
- data/spec/beaker-puppet/install_utils/module_utils_spec.rb +125 -116
- data/spec/beaker-puppet/install_utils/puppet5_spec.rb +159 -165
- data/spec/beaker-puppet/install_utils/puppet_utils_spec.rb +92 -77
- data/spec/beaker-puppet/install_utils/windows_utils_spec.rb +101 -89
- data/spec/beaker-puppet/wrappers_spec.rb +10 -10
- data/spec/helpers.rb +85 -91
- data/tasks/ci.rake +171 -179
- metadata +33 -62
- data/setup/common/020_InstallCumulusModules.rb +0 -13
- data/setup/common/021_InstallAristaModuleMasters.rb +0 -12
- data/setup/common/022_InstallAristaModuleAgents.rb +0 -13
@@ -18,211 +18,218 @@ end
|
|
18
18
|
describe ClassMixedWithDSLInstallUtils do
|
19
19
|
let(:presets) { Beaker::Options::Presets.new }
|
20
20
|
let(:opts) { presets.presets.merge(presets.env_vars) }
|
21
|
-
let(:basic_hosts)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
21
|
+
let(:basic_hosts) do
|
22
|
+
make_hosts({ pe_ver: '3.0',
|
23
|
+
platform: 'linux',
|
24
|
+
roles: ['agent'], }, 4)
|
25
|
+
end
|
26
|
+
let(:hosts) do
|
27
|
+
basic_hosts[0][:roles] = %w[master database dashboard]
|
28
|
+
basic_hosts[1][:platform] = 'windows'
|
29
|
+
basic_hosts[2][:platform] = 'osx-10.9-x86_64'
|
30
|
+
basic_hosts[3][:platform] = 'eos'
|
31
|
+
basic_hosts
|
32
|
+
end
|
33
|
+
let(:hosts_sorted) { [hosts[1], hosts[0], hosts[2], hosts[3]] }
|
32
34
|
|
33
35
|
describe '#install_dev_puppet_module_on' do
|
34
36
|
context 'having set allow( a ).to receive forge' do
|
35
37
|
it 'stubs the forge on the host' do
|
36
38
|
master = hosts.first
|
37
|
-
allow(
|
39
|
+
allow(subject).to receive(:options).and_return({ forge_host: 'ahost.com' })
|
38
40
|
|
39
|
-
subject.install_dev_puppet_module_on(
|
41
|
+
subject.install_dev_puppet_module_on(master, { source: '/module', module_name: 'test' })
|
40
42
|
end
|
41
43
|
|
42
44
|
it 'installs via #install_puppet_module_via_pmt' do
|
43
45
|
master = hosts.first
|
44
|
-
allow(
|
46
|
+
allow(subject).to receive(:options).and_return({ forge_host: 'ahost.com' })
|
45
47
|
|
46
|
-
expect(
|
48
|
+
expect(subject).to receive(:install_puppet_module_via_pmt_on)
|
47
49
|
|
48
|
-
subject.install_dev_puppet_module_on(
|
50
|
+
subject.install_dev_puppet_module_on(master, { source: '/module', module_name: 'test' })
|
49
51
|
end
|
50
52
|
end
|
51
53
|
context 'without allow( a ).to receive forge (default)' do
|
52
54
|
it 'calls copy_module_to to get the module on the SUT' do
|
53
55
|
master = hosts.first
|
54
|
-
allow(
|
56
|
+
allow(subject).to receive(:options).and_return({})
|
55
57
|
|
56
|
-
expect(
|
58
|
+
expect(subject).to receive(:copy_module_to)
|
57
59
|
|
58
|
-
subject.install_dev_puppet_module_on(
|
60
|
+
subject.install_dev_puppet_module_on(master, { source: '/module', module_name: 'test' })
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
65
|
describe '#install_dev_puppet_module' do
|
64
66
|
it 'delegates to #install_dev_puppet_module_on with the hosts list' do
|
65
|
-
allow(
|
66
|
-
allow(
|
67
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
68
|
+
allow(subject).to receive(:options).and_return({})
|
67
69
|
|
68
70
|
hosts.each do |host|
|
69
|
-
expect(
|
70
|
-
with(
|
71
|
+
expect(subject).to receive(:install_dev_puppet_module_on)
|
72
|
+
.with(host, { source: '/module', module_name: 'test' })
|
71
73
|
end
|
72
74
|
|
73
|
-
subject.install_dev_puppet_module(
|
75
|
+
subject.install_dev_puppet_module({ source: '/module', module_name: 'test' })
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
77
79
|
describe '#install_puppet_module_via_pmt_on' do
|
78
80
|
it 'installs module via puppet module tool' do
|
79
|
-
allow(
|
80
|
-
allow(
|
81
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
82
|
+
allow(subject).to receive(:options).and_return({})
|
81
83
|
master = hosts.first
|
82
84
|
|
83
|
-
allow(
|
84
|
-
expect(
|
85
|
+
allow(subject).to receive(:on).once
|
86
|
+
expect(subject).to receive(:puppet).with('module install test ', {}).once
|
85
87
|
|
86
|
-
subject.install_puppet_module_via_pmt_on(
|
88
|
+
subject.install_puppet_module_via_pmt_on(master, { module_name: 'test' })
|
87
89
|
end
|
88
90
|
|
89
91
|
it 'takes the trace option and passes it down correctly' do
|
90
|
-
allow(
|
91
|
-
allow(
|
92
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
93
|
+
allow(subject).to receive(:options).and_return({})
|
92
94
|
master = hosts.first
|
93
|
-
trace_opts = { :
|
95
|
+
trace_opts = { trace: nil }
|
94
96
|
master['default_module_install_opts'] = trace_opts
|
95
97
|
|
96
|
-
allow(
|
97
|
-
expect(
|
98
|
+
allow(subject).to receive(:on).once
|
99
|
+
expect(subject).to receive(:puppet).with('module install test ', trace_opts).once
|
98
100
|
|
99
|
-
subject.install_puppet_module_via_pmt_on(
|
101
|
+
subject.install_puppet_module_via_pmt_on(master, { module_name: 'test' })
|
100
102
|
end
|
101
103
|
|
102
104
|
it 'takes the forge_host option as a hostname and passes it down correctly' do
|
103
|
-
allow(
|
104
|
-
allow(
|
105
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
106
|
+
allow(subject).to receive(:options).and_return({ forge_host: 'forge.example.com' })
|
105
107
|
master = hosts.first
|
106
|
-
forge_opts = { :
|
108
|
+
forge_opts = { module_repository: 'https://forge.example.com' }
|
107
109
|
|
108
|
-
allow(
|
109
|
-
expect(
|
110
|
+
allow(subject).to receive(:on).once
|
111
|
+
expect(subject).to receive(:puppet).with('module install test ', forge_opts).once
|
110
112
|
|
111
|
-
subject.install_puppet_module_via_pmt_on(
|
113
|
+
subject.install_puppet_module_via_pmt_on(master, { module_name: 'test' })
|
112
114
|
end
|
113
115
|
|
114
116
|
it 'takes the forge_host option as a url and passes it down correctly' do
|
115
|
-
allow(
|
116
|
-
allow(
|
117
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
118
|
+
allow(subject).to receive(:options).and_return({ forge_host: 'http://forge.example.com' })
|
117
119
|
master = hosts.first
|
118
|
-
forge_opts = { :
|
120
|
+
forge_opts = { module_repository: 'http://forge.example.com' }
|
119
121
|
|
120
|
-
allow(
|
121
|
-
expect(
|
122
|
+
allow(subject).to receive(:on).once
|
123
|
+
expect(subject).to receive(:puppet).with('module install test ', forge_opts).once
|
122
124
|
|
123
|
-
subject.install_puppet_module_via_pmt_on(
|
125
|
+
subject.install_puppet_module_via_pmt_on(master, { module_name: 'test' })
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
127
129
|
describe '#install_puppet_module_via_pmt' do
|
128
130
|
it 'delegates to #install_puppet_module_via_pmt with the hosts list' do
|
129
|
-
allow(
|
131
|
+
allow(subject).to receive(:hosts).and_return(hosts)
|
130
132
|
|
131
|
-
expect(
|
133
|
+
expect(subject).to receive(:install_puppet_module_via_pmt_on).with(hosts,
|
134
|
+
{ source: '/module',
|
135
|
+
module_name: 'test', }).once
|
132
136
|
|
133
|
-
subject.install_puppet_module_via_pmt(
|
137
|
+
subject.install_puppet_module_via_pmt({ source: '/module', module_name: 'test' })
|
134
138
|
end
|
135
139
|
end
|
136
140
|
|
137
141
|
describe 'copy_module_to' do
|
138
142
|
let(:ignore_list) { Beaker::DSL::InstallUtils::ModuleUtils::PUPPET_MODULE_INSTALL_IGNORE }
|
139
|
-
let(:source){ File.expand_path('./')}
|
140
|
-
let(:target){'/etc/puppetlabs/puppet/modules/testmodule'}
|
141
|
-
let(:module_parse_name){'testmodule'}
|
142
|
-
|
143
|
-
shared_examples 'copy_module_to' do
|
144
|
-
it{
|
145
|
-
host = double(
|
146
|
-
allow(
|
147
|
-
allow(
|
143
|
+
let(:source) { File.expand_path('./') }
|
144
|
+
let(:target) { '/etc/puppetlabs/puppet/modules/testmodule' }
|
145
|
+
let(:module_parse_name) { 'testmodule' }
|
146
|
+
|
147
|
+
shared_examples 'copy_module_to' do |opts|
|
148
|
+
it {
|
149
|
+
host = double('host')
|
150
|
+
allow(host).to receive(:[]).with('distmoduledir').and_return('/etc/puppetlabs/puppet/modules')
|
151
|
+
allow(host).to receive(:is_powershell?).and_return(false)
|
148
152
|
result = double
|
149
153
|
stdout = target.split('/')[0..-2].join('/') + "\n"
|
150
|
-
allow(
|
151
|
-
expect(
|
152
|
-
allow(
|
154
|
+
allow(result).to receive(:stdout).and_return(stdout)
|
155
|
+
expect(subject).to receive(:on).with(host, "echo #{File.dirname(target)}").and_return(result)
|
156
|
+
allow(Dir).to receive(:getpwd).and_return(source)
|
153
157
|
|
154
|
-
allow(
|
158
|
+
allow(subject).to receive(:parse_for_moduleroot).and_return(source)
|
155
159
|
if module_parse_name
|
156
|
-
allow(
|
160
|
+
allow(subject).to receive(:parse_for_modulename).with(any_args).and_return(module_parse_name)
|
157
161
|
else
|
158
|
-
expect(
|
162
|
+
expect(subject).to_not receive(:parse_for_modulename)
|
159
163
|
end
|
160
164
|
|
161
|
-
allow(
|
162
|
-
allow(
|
165
|
+
allow(File).to receive(:exist?).with(any_args).and_return(false)
|
166
|
+
allow(File).to receive(:directory?).with(any_args).and_return(false)
|
163
167
|
|
164
|
-
expect(
|
165
|
-
expect(
|
168
|
+
expect(subject).to receive(:scp_to).with(host, source, File.dirname(target), { ignore: ignore_list })
|
169
|
+
expect(host).to receive(:mv).with(File.join(File.dirname(target), File.basename(source)), target)
|
166
170
|
if opts.nil?
|
167
171
|
subject.copy_module_to(host)
|
168
172
|
else
|
169
|
-
subject.copy_module_to(host,opts)
|
173
|
+
subject.copy_module_to(host, opts)
|
170
174
|
end
|
171
175
|
}
|
172
176
|
end
|
173
177
|
|
174
178
|
describe 'should call scp with the correct info, with only providing host' do
|
175
|
-
let(:target){'/etc/puppetlabs/puppet/modules/testmodule'}
|
179
|
+
let(:target) { '/etc/puppetlabs/puppet/modules/testmodule' }
|
176
180
|
|
177
|
-
it_should_behave_like 'copy_module_to', :
|
181
|
+
it_should_behave_like 'copy_module_to', module_name: 'testmodule'
|
178
182
|
end
|
179
183
|
|
180
184
|
describe 'should call scp with the correct info, when specifying the modulename' do
|
181
|
-
let(:target){'/etc/puppetlabs/puppet/modules/bogusmodule'}
|
182
|
-
let(:module_parse_name){false}
|
183
|
-
it_should_behave_like 'copy_module_to', {:
|
185
|
+
let(:target) { '/etc/puppetlabs/puppet/modules/bogusmodule' }
|
186
|
+
let(:module_parse_name) { false }
|
187
|
+
it_should_behave_like 'copy_module_to', { module_name: 'bogusmodule' }
|
184
188
|
end
|
185
189
|
|
186
190
|
describe 'should call scp with the correct info, when specifying the target to a different path' do
|
187
191
|
target = '/opt/shared/puppet/modules'
|
188
|
-
let(:target){"#{target}/testmodule"}
|
189
|
-
it_should_behave_like 'copy_module_to', {:
|
192
|
+
let(:target) { "#{target}/testmodule" }
|
193
|
+
it_should_behave_like 'copy_module_to', { target_module_path: target, module_name: 'testmodule' }
|
190
194
|
end
|
191
195
|
|
192
196
|
describe 'should accept multiple hosts when' do
|
193
197
|
it 'used in a default manner' do
|
194
|
-
allow(
|
195
|
-
allow(
|
196
|
-
allow(
|
198
|
+
allow(subject).to receive(:build_ignore_list).and_return([])
|
199
|
+
allow(subject).to receive(:parse_for_modulename).and_return([nil, 'modulename'])
|
200
|
+
allow(subject).to receive(:on).and_return(double.as_null_object)
|
197
201
|
|
198
|
-
expect(
|
199
|
-
subject.copy_module_to(
|
202
|
+
expect(subject).to receive(:scp_to).exactly(4).times
|
203
|
+
subject.copy_module_to(hosts)
|
200
204
|
end
|
201
205
|
end
|
202
206
|
|
203
207
|
describe 'non-cygwin windows' do
|
204
208
|
it 'should have different commands than cygwin' do
|
205
|
-
host = double(
|
206
|
-
allow(
|
207
|
-
allow(
|
208
|
-
allow(
|
209
|
+
host = double('host')
|
210
|
+
allow(host).to receive(:[]).with('platform').and_return('windows')
|
211
|
+
allow(host).to receive(:[]).with('distmoduledir').and_return('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
212
|
+
allow(host).to receive(:is_powershell?).and_return(true)
|
209
213
|
|
210
214
|
result = double
|
211
|
-
allow(
|
215
|
+
allow(result).to receive(:stdout).and_return('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
|
212
216
|
|
213
|
-
expect(
|
217
|
+
expect(subject).to receive(:on).with(host,
|
218
|
+
'echo C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules').and_return(result)
|
214
219
|
|
215
|
-
expect(
|
216
|
-
|
220
|
+
expect(subject).to receive(:scp_to).with(host, '/opt/testmodule2',
|
221
|
+
'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules', { ignore: ignore_list })
|
222
|
+
expect(host).to receive(:mv).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules\\testmodule2',
|
223
|
+
'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules\\testmodule')
|
217
224
|
|
218
|
-
subject.copy_module_to(host, {:
|
225
|
+
subject.copy_module_to(host, { module_name: 'testmodule', source: '/opt/testmodule2' })
|
219
226
|
end
|
220
227
|
end
|
221
228
|
end
|
222
229
|
|
223
230
|
describe 'split_author_modulename' do
|
224
231
|
it 'should return a correct modulename' do
|
225
|
-
result =
|
232
|
+
result = subject.split_author_modulename('myname-test_43_module')
|
226
233
|
expect(result[:author]).to eq('myname')
|
227
234
|
expect(result[:module]).to eq('test_43_module')
|
228
235
|
end
|
@@ -230,7 +237,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
230
237
|
|
231
238
|
describe 'get_module_name' do
|
232
239
|
it 'should return an array of author and modulename' do
|
233
|
-
expect(subject.get_module_name('myname-test_43_module')).to eq([
|
240
|
+
expect(subject.get_module_name('myname-test_43_module')).to eq(%w[myname test_43_module])
|
234
241
|
end
|
235
242
|
it 'should return nil for invalid names' do
|
236
243
|
expect(subject.get_module_name('myname-')).to eq(nil)
|
@@ -239,7 +246,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
239
246
|
|
240
247
|
describe 'get_target_module_path' do
|
241
248
|
let(:host) do
|
242
|
-
host = make_host("echo '/explicit/modulepath'", {stdout: "/explicit/modulepath\n"})
|
249
|
+
host = make_host("echo '/explicit/modulepath'", { stdout: "/explicit/modulepath\n" })
|
243
250
|
allow(host).to receive(:puppet).and_return(puppet)
|
244
251
|
host
|
245
252
|
end
|
@@ -258,7 +265,9 @@ describe ClassMixedWithDSLInstallUtils do
|
|
258
265
|
end
|
259
266
|
|
260
267
|
it 'should raise an error if no directory is found' do
|
261
|
-
expect
|
268
|
+
expect do
|
269
|
+
subject.get_target_module_path(host)
|
270
|
+
end.to raise_error(ArgumentError, 'Unable to find target module path to copy to')
|
262
271
|
expect(puppet).to have_received(:[]).with('basemodulepath')
|
263
272
|
end
|
264
273
|
end
|
@@ -295,19 +304,19 @@ describe ClassMixedWithDSLInstallUtils do
|
|
295
304
|
describe 'parse_for_modulename' do
|
296
305
|
directory = '/testfilepath/myname-testmodule'
|
297
306
|
it 'should return name from metadata.json' do
|
298
|
-
allow(
|
299
|
-
allow(
|
300
|
-
expect(
|
307
|
+
allow(File).to receive(:exist?).with("#{directory}/metadata.json").and_return(true)
|
308
|
+
allow(File).to receive(:read).with("#{directory}/metadata.json").and_return(' {"name":"myname-testmodule"} ')
|
309
|
+
expect(subject.logger).to receive(:debug).with('Attempting to parse Modulename from metadata.json')
|
301
310
|
expect(subject.logger).to_not receive(:debug).with('Unable to determine name, returning null')
|
302
|
-
expect(subject.parse_for_modulename(directory)).to eq([
|
311
|
+
expect(subject.parse_for_modulename(directory)).to eq(%w[myname testmodule])
|
303
312
|
end
|
304
313
|
it 'should return name from Modulefile' do
|
305
|
-
allow(
|
306
|
-
allow(
|
307
|
-
allow(
|
308
|
-
expect(
|
309
|
-
expect(subject.logger).to_not receive(:debug).with(
|
310
|
-
expect(subject.parse_for_modulename(directory)).to eq([
|
314
|
+
allow(File).to receive(:exist?).with("#{directory}/metadata.json").and_return(false)
|
315
|
+
allow(File).to receive(:exist?).with("#{directory}/Modulefile").and_return(true)
|
316
|
+
allow(File).to receive(:read).with("#{directory}/Modulefile").and_return("name 'myname-testmodule' \nauthor 'myname'")
|
317
|
+
expect(subject.logger).to receive(:debug).with('Attempting to parse Modulename from Modulefile')
|
318
|
+
expect(subject.logger).to_not receive(:debug).with('Unable to determine name, returning null')
|
319
|
+
expect(subject.parse_for_modulename(directory)).to eq(%w[myname testmodule])
|
311
320
|
end
|
312
321
|
end
|
313
322
|
|
@@ -315,26 +324,26 @@ describe ClassMixedWithDSLInstallUtils do
|
|
315
324
|
directory = '/testfilepath/myname-testmodule'
|
316
325
|
describe 'stops searching when either' do
|
317
326
|
it 'finds a Modulefile' do
|
318
|
-
allow(
|
319
|
-
allow(
|
327
|
+
allow(File).to receive(:exist?).and_return(false)
|
328
|
+
allow(File).to receive(:exist?).with("#{directory}/Modulefile").and_return(true)
|
320
329
|
|
321
|
-
expect(
|
322
|
-
expect(
|
330
|
+
expect(subject.logger).to_not receive(:debug).with("At root, can't parse for another directory")
|
331
|
+
expect(subject.logger).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}/acceptance, moving up")
|
323
332
|
expect(subject.parse_for_moduleroot("#{directory}/acceptance")).to eq(directory)
|
324
333
|
end
|
325
334
|
it 'finds a metadata.json file' do
|
326
|
-
allow(
|
327
|
-
allow(
|
335
|
+
allow(File).to receive(:exist?).and_return(false)
|
336
|
+
allow(File).to receive(:exist?).with("#{directory}/metadata.json").and_return(true)
|
328
337
|
|
329
|
-
expect(
|
330
|
-
expect(
|
338
|
+
expect(subject.logger).to_not receive(:debug).with("At root, can't parse for another directory")
|
339
|
+
expect(subject.logger).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}/acceptance, moving up")
|
331
340
|
expect(subject.parse_for_moduleroot("#{directory}/acceptance")).to eq(directory)
|
332
341
|
end
|
333
342
|
end
|
334
343
|
it 'should recersively go up the directory to find the module files' do
|
335
|
-
allow(
|
336
|
-
expect(
|
337
|
-
expect(
|
344
|
+
allow(File).to receive(:exist?).and_return(false)
|
345
|
+
expect(subject.logger).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}, moving up")
|
346
|
+
expect(subject.logger).to receive(:error).with("At root, can't parse for another directory")
|
338
347
|
expect(subject.parse_for_moduleroot(directory)).to eq(nil)
|
339
348
|
end
|
340
349
|
end
|