r10k 3.9.0 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +1 -1
- data/.github/workflows/rspec_tests.yml +1 -1
- data/.github/workflows/stale.yml +19 -0
- data/CHANGELOG.mkd +24 -0
- data/doc/dynamic-environments/configuration.mkd +13 -6
- data/integration/Rakefile +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +3 -9
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +8 -14
- data/lib/r10k/action/base.rb +10 -0
- data/lib/r10k/action/deploy/display.rb +42 -9
- data/lib/r10k/action/deploy/environment.rb +70 -41
- data/lib/r10k/action/deploy/module.rb +51 -29
- data/lib/r10k/action/puppetfile/check.rb +3 -1
- data/lib/r10k/action/puppetfile/install.rb +20 -23
- data/lib/r10k/action/puppetfile/purge.rb +8 -2
- data/lib/r10k/action/runner.rb +11 -6
- data/lib/r10k/content_synchronizer.rb +83 -0
- data/lib/r10k/deployment.rb +1 -1
- data/lib/r10k/environment/base.rb +21 -1
- data/lib/r10k/environment/git.rb +0 -3
- data/lib/r10k/environment/svn.rb +4 -6
- data/lib/r10k/environment/with_modules.rb +18 -10
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/initializers.rb +7 -0
- data/lib/r10k/module.rb +1 -1
- data/lib/r10k/module/base.rb +17 -1
- data/lib/r10k/module/forge.rb +29 -19
- data/lib/r10k/module/git.rb +23 -14
- data/lib/r10k/module/local.rb +1 -0
- data/lib/r10k/module/svn.rb +12 -9
- data/lib/r10k/module_loader/puppetfile.rb +195 -0
- data/lib/r10k/module_loader/puppetfile/dsl.rb +37 -0
- data/lib/r10k/puppetfile.rb +111 -202
- data/lib/r10k/settings.rb +3 -0
- data/lib/r10k/source/base.rb +14 -0
- data/lib/r10k/source/git.rb +19 -6
- data/lib/r10k/source/hash.rb +1 -3
- data/lib/r10k/source/svn.rb +4 -2
- data/lib/r10k/util/cleaner.rb +21 -0
- data/lib/r10k/util/purgeable.rb +70 -8
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +67 -71
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +4 -0
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +3 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_subdir_2/ignored_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3 +0 -0
- data/spec/r10k-mocks/mock_source.rb +1 -1
- data/spec/shared-examples/puppetfile-action.rb +7 -7
- data/spec/unit/action/deploy/display_spec.rb +32 -6
- data/spec/unit/action/deploy/environment_spec.rb +85 -48
- data/spec/unit/action/deploy/module_spec.rb +163 -31
- data/spec/unit/action/puppetfile/check_spec.rb +2 -2
- data/spec/unit/action/puppetfile/install_spec.rb +31 -10
- data/spec/unit/action/puppetfile/purge_spec.rb +25 -5
- data/spec/unit/action/runner_spec.rb +49 -25
- data/spec/unit/git/cache_spec.rb +14 -0
- data/spec/unit/module/forge_spec.rb +23 -14
- data/spec/unit/module/git_spec.rb +8 -8
- data/spec/unit/module_loader/puppetfile_spec.rb +330 -0
- data/spec/unit/module_spec.rb +22 -5
- data/spec/unit/puppetfile_spec.rb +123 -203
- data/spec/unit/settings_spec.rb +6 -2
- data/spec/unit/util/purgeable_spec.rb +40 -14
- metadata +12 -2
data/spec/unit/module_spec.rb
CHANGED
@@ -30,12 +30,12 @@ describe R10K::Module do
|
|
30
30
|
[ 'bar/quux',
|
31
31
|
'bar-quux',
|
32
32
|
].each do |scenario|
|
33
|
-
it "accepts a name matching #{scenario} and
|
34
|
-
obj = R10K::Module.new(scenario, '/modulepath', nil)
|
33
|
+
it "accepts a name matching #{scenario} and version nil" do
|
34
|
+
obj = R10K::Module.new(scenario, '/modulepath', { version: nil })
|
35
35
|
expect(obj).to be_a_kind_of(R10K::Module::Forge)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
[ '8.0.0',
|
38
|
+
[ {version: '8.0.0'},
|
39
39
|
{type: 'forge', version: '8.0.0'},
|
40
40
|
].each do |scenario|
|
41
41
|
it "accepts a name matching bar-quux and args #{scenario.inspect}" do
|
@@ -65,7 +65,7 @@ describe R10K::Module do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'sets the expected version to what is found in the metadata' do
|
68
|
-
obj = R10K::Module.new(@title, @dirname, nil)
|
68
|
+
obj = R10K::Module.new(@title, @dirname, {version: nil})
|
69
69
|
expect(obj.send(:instance_variable_get, :'@expected_version')).to eq('1.2.0')
|
70
70
|
end
|
71
71
|
end
|
@@ -73,7 +73,24 @@ describe R10K::Module do
|
|
73
73
|
|
74
74
|
it "raises an error if delegation fails" do
|
75
75
|
expect {
|
76
|
-
R10K::Module.new('bar!quux', '/modulepath', ["NOPE NOPE NOPE NOPE!"])
|
76
|
+
R10K::Module.new('bar!quux', '/modulepath', {version: ["NOPE NOPE NOPE NOPE!"]})
|
77
77
|
}.to raise_error RuntimeError, /doesn't have an implementation/
|
78
78
|
end
|
79
|
+
|
80
|
+
describe 'when a user passes a `default_branch_override`' do
|
81
|
+
[ ['name', {git: 'git url'}],
|
82
|
+
['name', {type: 'git', source: 'git url'}],
|
83
|
+
['name', {svn: 'svn url'}],
|
84
|
+
['name', {type: 'svn', source: 'svn url'}],
|
85
|
+
['namespace-name', {version: '8.0.0'}],
|
86
|
+
['namespace-name', {type: 'forge', version: '8.0.0'}]
|
87
|
+
].each do |(name, options)|
|
88
|
+
it 'can handle the default_branch_override option' do
|
89
|
+
expect {
|
90
|
+
obj = R10K::Module.new(name, '/modulepath', options.merge({default_branch_override: 'foo'}))
|
91
|
+
expect(obj).to be_a_kind_of(R10K::Module::Base)
|
92
|
+
}.not_to raise_error
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
79
96
|
end
|
@@ -6,9 +6,7 @@ describe R10K::Puppetfile do
|
|
6
6
|
subject do
|
7
7
|
described_class.new(
|
8
8
|
'/some/nonexistent/basedir',
|
9
|
-
|
10
|
-
nil,
|
11
|
-
'Puppetfile.r10k'
|
9
|
+
{puppetfile_name: 'Puppetfile.r10k'}
|
12
10
|
)
|
13
11
|
end
|
14
12
|
|
@@ -23,9 +21,25 @@ end
|
|
23
21
|
describe R10K::Puppetfile do
|
24
22
|
|
25
23
|
subject do
|
26
|
-
described_class.new(
|
27
|
-
|
28
|
-
|
24
|
+
described_class.new( '/some/nonexistent/basedir', {})
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "backwards compatibility with older calling conventions" do
|
28
|
+
it "honors all arguments correctly" do
|
29
|
+
puppetfile = described_class.new('/some/nonexistant/basedir', '/some/nonexistant/basedir/site-modules', nil, 'Pupupupetfile', true)
|
30
|
+
expect(puppetfile.force).to eq(true)
|
31
|
+
expect(puppetfile.moduledir).to eq('/some/nonexistant/basedir/site-modules')
|
32
|
+
expect(puppetfile.puppetfile_path).to eq('/some/nonexistant/basedir/Pupupupetfile')
|
33
|
+
expect(puppetfile.overrides).to eq({})
|
34
|
+
end
|
35
|
+
|
36
|
+
it "handles defaults correctly" do
|
37
|
+
puppetfile = described_class.new('/some/nonexistant/basedir', nil, nil, nil)
|
38
|
+
expect(puppetfile.force).to eq(false)
|
39
|
+
expect(puppetfile.moduledir).to eq('/some/nonexistant/basedir/modules')
|
40
|
+
expect(puppetfile.puppetfile_path).to eq('/some/nonexistant/basedir/Puppetfile')
|
41
|
+
expect(puppetfile.overrides).to eq({})
|
42
|
+
end
|
29
43
|
end
|
30
44
|
|
31
45
|
describe "the default moduledir" do
|
@@ -53,230 +67,136 @@ describe R10K::Puppetfile do
|
|
53
67
|
end
|
54
68
|
end
|
55
69
|
|
56
|
-
describe "
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
expect(subject.modules.collect(&:name)).to include('test_module')
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should not accept Forge modules with a version comparison" do
|
65
|
-
allow(R10K::Module).to receive(:new).with('puppet/test_module', subject.moduledir, '< 1.2.0', anything).and_call_original
|
66
|
-
|
67
|
-
expect {
|
68
|
-
subject.add_module('puppet/test_module', '< 1.2.0')
|
69
|
-
}.to raise_error(RuntimeError, /module puppet\/test_module.*doesn't have an implementation/i)
|
70
|
-
|
71
|
-
expect(subject.modules.collect(&:name)).not_to include('test_module')
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should accept non-Forge modules with a hash arg" do
|
75
|
-
module_opts = { git: 'git@example.com:puppet/test_module.git' }
|
70
|
+
describe "loading a Puppetfile" do
|
71
|
+
context 'using load' do
|
72
|
+
it "returns the loaded content" do
|
73
|
+
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
74
|
+
subject = described_class.new(path, {})
|
76
75
|
|
77
|
-
|
76
|
+
loaded_content = subject.load
|
77
|
+
expect(loaded_content).to be_an_instance_of(Hash)
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
it "should accept non-Forge modules with a valid relative :install_path option" do
|
84
|
-
module_opts = {
|
85
|
-
install_path: 'vendor',
|
86
|
-
git: 'git@example.com:puppet/test_module.git',
|
87
|
-
}
|
88
|
-
|
89
|
-
allow(R10K::Module).to receive(:new).with('puppet/test_module', File.join(subject.basedir, 'vendor'), module_opts, anything).and_call_original
|
90
|
-
|
91
|
-
expect { subject.add_module('puppet/test_module', module_opts) }.to change { subject.modules }
|
92
|
-
expect(subject.modules.collect(&:name)).to include('test_module')
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should accept non-Forge modules with a valid absolute :install_path option" do
|
96
|
-
install_path = File.join(subject.basedir, 'vendor')
|
97
|
-
|
98
|
-
module_opts = {
|
99
|
-
install_path: install_path,
|
100
|
-
git: 'git@example.com:puppet/test_module.git',
|
101
|
-
}
|
102
|
-
|
103
|
-
allow(R10K::Module).to receive(:new).with('puppet/test_module', install_path, module_opts, anything).and_call_original
|
104
|
-
|
105
|
-
expect { subject.add_module('puppet/test_module', module_opts) }.to change { subject.modules }
|
106
|
-
expect(subject.modules.collect(&:name)).to include('test_module')
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should reject non-Forge modules with an invalid relative :install_path option" do
|
110
|
-
module_opts = {
|
111
|
-
install_path: '../../vendor',
|
112
|
-
git: 'git@example.com:puppet/test_module.git',
|
113
|
-
}
|
114
|
-
|
115
|
-
allow(R10K::Module).to receive(:new).with('puppet/test_module', File.join(subject.basedir, 'vendor'), module_opts, anything).and_call_original
|
116
|
-
|
117
|
-
expect { subject.add_module('puppet/test_module', module_opts) }.to raise_error(R10K::Error, /cannot manage content.*is not within/i).and not_change { subject.modules }
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should reject non-Forge modules with an invalid absolute :install_path option" do
|
121
|
-
module_opts = {
|
122
|
-
install_path: '/tmp/mydata/vendor',
|
123
|
-
git: 'git@example.com:puppet/test_module.git',
|
124
|
-
}
|
79
|
+
has_some_data = loaded_content.values.none?(&:empty?)
|
80
|
+
expect(has_some_data).to be true
|
81
|
+
end
|
125
82
|
|
126
|
-
|
83
|
+
it "is idempotent" do
|
84
|
+
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
85
|
+
subject = described_class.new(path, {})
|
127
86
|
|
128
|
-
|
129
|
-
end
|
87
|
+
expect(subject.loader).to receive(:load).and_call_original.once
|
130
88
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
allow(mod).to receive(:origin=).and_return(nil)
|
135
|
-
allow(subject).to receive(:environment).and_return(env)
|
136
|
-
allow(env).to receive(:'module_conflicts?').with(mod).and_return(true)
|
89
|
+
loaded_content1 = subject.load
|
90
|
+
expect(subject.loaded?).to be true
|
91
|
+
loaded_content2 = subject.load
|
137
92
|
|
138
|
-
|
139
|
-
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "#purge_exclusions" do
|
144
|
-
let(:managed_dirs) { ['dir1', 'dir2'] }
|
93
|
+
expect(loaded_content2).to eq(loaded_content1)
|
94
|
+
end
|
145
95
|
|
146
|
-
|
147
|
-
|
96
|
+
it "returns nil if Puppetfile doesn't exist" do
|
97
|
+
path = '/rando/path/that/wont/exist'
|
98
|
+
subject = described_class.new(path, {})
|
99
|
+
expect(subject.load).to eq nil
|
100
|
+
end
|
148
101
|
end
|
149
102
|
|
150
|
-
|
151
|
-
|
152
|
-
|
103
|
+
context 'using load!' do
|
104
|
+
it "returns the loaded content" do
|
105
|
+
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
106
|
+
subject = described_class.new(path, {})
|
153
107
|
|
154
|
-
|
155
|
-
|
108
|
+
loaded_content = subject.load!
|
109
|
+
expect(loaded_content).to be_an_instance_of(Hash)
|
156
110
|
|
157
|
-
|
158
|
-
|
159
|
-
allow(subject).to receive(:environment).and_return(mock_env)
|
111
|
+
has_some_data = loaded_content.values.none?(&:empty?)
|
112
|
+
expect(has_some_data).to be true
|
160
113
|
end
|
161
114
|
|
162
|
-
it "
|
163
|
-
|
115
|
+
it "raises if Puppetfile doesn't exist" do
|
116
|
+
path = '/rando/path/that/wont/exist'
|
117
|
+
subject = described_class.new(path, {})
|
118
|
+
expect {
|
119
|
+
subject.load!
|
120
|
+
}.to raise_error(/No such file or directory.*\/rando\/path\/.*/)
|
164
121
|
end
|
165
122
|
end
|
166
123
|
end
|
167
124
|
|
168
|
-
describe '
|
169
|
-
it '
|
170
|
-
|
125
|
+
describe 'default_branch_override' do
|
126
|
+
it 'is passed correctly to module loader init' do
|
127
|
+
# This path doesn't matter so long as it has a Puppetfile within it
|
128
|
+
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
129
|
+
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
171
130
|
|
172
|
-
|
173
|
-
|
174
|
-
|
131
|
+
repo = instance_double('R10K::Git::StatefulRepository')
|
132
|
+
allow(repo).to receive(:resolve).with('foo').and_return(true)
|
133
|
+
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
175
134
|
|
176
|
-
|
177
|
-
|
178
|
-
|
135
|
+
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
136
|
+
# Track control branch and fall-back to main if no matching branch.
|
137
|
+
mod 'hieradata',
|
138
|
+
:git => 'git@git.example.com:organization/hieradata.git',
|
139
|
+
:branch => :control_branch,
|
140
|
+
:default_branch => 'main'
|
141
|
+
EOPF
|
179
142
|
|
180
|
-
|
143
|
+
expect(subject.logger).not_to receive(:warn).
|
144
|
+
with(/Mismatch between passed and initialized.*preferring passed value/)
|
181
145
|
|
182
|
-
|
183
|
-
expect(subject.managed_directories).to be_empty
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
146
|
+
subject.load
|
187
147
|
|
188
|
-
|
189
|
-
|
190
|
-
expect(orig).to be_a_kind_of(R10K::Error)
|
191
|
-
expect(orig.message).to eq("Failed to evaluate #{pf_path}")
|
192
|
-
expect(orig.original).to be_a_kind_of(wrapped_error)
|
148
|
+
loaded_module = subject.modules.first
|
149
|
+
expect(loaded_module.version).to eq('foo')
|
193
150
|
end
|
194
151
|
|
195
|
-
it
|
196
|
-
|
197
|
-
|
198
|
-
subject = described_class.new(path)
|
199
|
-
expect {
|
200
|
-
subject.load!
|
201
|
-
}.to raise_error do |e|
|
202
|
-
expect_wrapped_error(e, pf_path, SyntaxError)
|
203
|
-
end
|
204
|
-
end
|
152
|
+
it 'overrides module loader init if needed' do
|
153
|
+
# This path doesn't matter so long as it has a Puppetfile within it
|
154
|
+
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
155
|
+
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
205
156
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
subject = described_class.new(path)
|
210
|
-
expect {
|
211
|
-
subject.load!
|
212
|
-
}.to raise_error do |e|
|
213
|
-
expect_wrapped_error(e, pf_path, LoadError)
|
214
|
-
end
|
215
|
-
end
|
157
|
+
repo = instance_double('R10K::Git::StatefulRepository')
|
158
|
+
allow(repo).to receive(:resolve).with('bar').and_return(true)
|
159
|
+
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
216
160
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
expect_wrapped_error(e, pf_path, ArgumentError)
|
225
|
-
end
|
226
|
-
end
|
161
|
+
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
162
|
+
# Track control branch and fall-back to main if no matching branch.
|
163
|
+
mod 'hieradata',
|
164
|
+
:git => 'git@git.example.com:organization/hieradata.git',
|
165
|
+
:branch => :control_branch,
|
166
|
+
:default_branch => 'main'
|
167
|
+
EOPF
|
227
168
|
|
228
|
-
|
229
|
-
|
230
|
-
pf_path = File.join(path, 'Puppetfile')
|
231
|
-
subject = described_class.new(path)
|
232
|
-
expect {
|
233
|
-
subject.load!
|
234
|
-
}.to raise_error(R10K::Error, /Puppetfiles cannot contain duplicate module names/i)
|
235
|
-
end
|
169
|
+
expect(subject.logger).to receive(:warn).
|
170
|
+
with(/Mismatch between passed and initialized.*preferring passed value/)
|
236
171
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
subject = described_class.new(path)
|
241
|
-
expect {
|
242
|
-
subject.load!
|
243
|
-
}.to raise_error do |e|
|
244
|
-
expect_wrapped_error(e, pf_path, NameError)
|
245
|
-
end
|
172
|
+
subject.load('bar')
|
173
|
+
loaded_module = subject.modules.first
|
174
|
+
expect(loaded_module.version).to eq('bar')
|
246
175
|
end
|
247
176
|
|
248
|
-
it
|
177
|
+
it 'does not warn if passed and initialized default_branch_overrides match' do
|
178
|
+
# This path doesn't matter so long as it has a Puppetfile within it
|
249
179
|
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
250
|
-
|
251
|
-
subject = described_class.new(path)
|
252
|
-
expect { subject.load! }.not_to raise_error
|
253
|
-
end
|
180
|
+
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
254
181
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
subject = described_class.new(path)
|
259
|
-
expect { subject.load! }.not_to raise_error
|
260
|
-
end
|
182
|
+
repo = instance_double('R10K::Git::StatefulRepository')
|
183
|
+
allow(repo).to receive(:resolve).with('foo').and_return(true)
|
184
|
+
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
261
185
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
186
|
+
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
187
|
+
# Track control branch and fall-back to main if no matching branch.
|
188
|
+
mod 'hieradata',
|
189
|
+
:git => 'git@git.example.com:organization/hieradata.git',
|
190
|
+
:branch => :control_branch,
|
191
|
+
:default_branch => 'main'
|
192
|
+
EOPF
|
193
|
+
|
194
|
+
expect(subject.logger).not_to receive(:warn).
|
195
|
+
with(/Mismatch between passed and initialized.*preferring passed value/)
|
270
196
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
subject = described_class.new(path)
|
275
|
-
default_branch_override = 'default_branch_override_name'
|
276
|
-
expect { subject.load!(default_branch_override) }.not_to raise_error
|
277
|
-
git_module = subject.modules[0]
|
278
|
-
expect(git_module.default_override_ref).to eq default_branch_override
|
279
|
-
expect(git_module.default_ref).to eq "here_lies_the_default_branch"
|
197
|
+
subject.load('foo')
|
198
|
+
loaded_module = subject.modules.first
|
199
|
+
expect(loaded_module.version).to eq('foo')
|
280
200
|
end
|
281
201
|
end
|
282
202
|
|
@@ -287,7 +207,7 @@ describe R10K::Puppetfile do
|
|
287
207
|
subject.accept(visitor)
|
288
208
|
end
|
289
209
|
|
290
|
-
it "
|
210
|
+
it "synchronizes each module if the visitor yields" do
|
291
211
|
visitor = spy('visitor')
|
292
212
|
expect(visitor).to receive(:visit) do |type, other, &block|
|
293
213
|
expect(type).to eq :puppetfile
|
@@ -297,8 +217,8 @@ describe R10K::Puppetfile do
|
|
297
217
|
|
298
218
|
mod1 = instance_double('R10K::Module::Base', :cachedir => :none)
|
299
219
|
mod2 = instance_double('R10K::Module::Base', :cachedir => :none)
|
300
|
-
expect(mod1).to receive(:
|
301
|
-
expect(mod2).to receive(:
|
220
|
+
expect(mod1).to receive(:sync)
|
221
|
+
expect(mod2).to receive(:sync)
|
302
222
|
expect(subject).to receive(:modules).and_return([mod1, mod2])
|
303
223
|
|
304
224
|
subject.accept(visitor)
|
@@ -318,8 +238,8 @@ describe R10K::Puppetfile do
|
|
318
238
|
|
319
239
|
mod1 = instance_double('R10K::Module::Base', :cachedir => :none)
|
320
240
|
mod2 = instance_double('R10K::Module::Base', :cachedir => :none)
|
321
|
-
expect(mod1).to receive(:
|
322
|
-
expect(mod2).to receive(:
|
241
|
+
expect(mod1).to receive(:sync)
|
242
|
+
expect(mod2).to receive(:sync)
|
323
243
|
expect(subject).to receive(:modules).and_return([mod1, mod2])
|
324
244
|
|
325
245
|
expect(Thread).to receive(:new).exactly(pool_size).and_call_original
|
@@ -343,9 +263,9 @@ describe R10K::Puppetfile do
|
|
343
263
|
m5 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/D')
|
344
264
|
m6 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/D')
|
345
265
|
|
346
|
-
|
266
|
+
modules = [m1, m2, m3, m4, m5, m6]
|
347
267
|
|
348
|
-
queue =
|
268
|
+
queue = R10K::ContentSynchronizer.modules_visit_queue(modules, visitor, subject)
|
349
269
|
expect(queue.length).to be 4
|
350
270
|
queue_array = 4.times.map { queue.pop }
|
351
271
|
expect(queue_array).to match_array([[m1], [m2], [m3, m4], [m5, m6]])
|