r10k 3.5.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +4 -1
  3. data/.github/workflows/docker.yml +25 -1
  4. data/.github/workflows/rspec_tests.yml +81 -0
  5. data/.travis.yml +14 -11
  6. data/CHANGELOG.mkd +42 -6
  7. data/CODEOWNERS +1 -1
  8. data/Gemfile +1 -1
  9. data/README.mkd +13 -4
  10. data/azure-pipelines.yml +2 -1
  11. data/doc/dynamic-environments/configuration.mkd +60 -3
  12. data/doc/dynamic-environments/usage.mkd +5 -4
  13. data/doc/faq.mkd +6 -1
  14. data/doc/puppetfile.mkd +2 -0
  15. data/docker/Makefile +16 -2
  16. data/docker/r10k/Dockerfile +17 -6
  17. data/docker/r10k/release.Dockerfile +23 -4
  18. data/integration/tests/git_source/git_source_repeated_remote.rb +68 -0
  19. data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +1 -1
  20. data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +1 -1
  21. data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +1 -1
  22. data/lib/r10k/action/deploy/environment.rb +3 -0
  23. data/lib/r10k/action/deploy/module.rb +4 -1
  24. data/lib/r10k/action/runner.rb +34 -0
  25. data/lib/r10k/cli/deploy.rb +9 -4
  26. data/lib/r10k/cli/puppetfile.rb +5 -5
  27. data/lib/r10k/environment/base.rb +8 -1
  28. data/lib/r10k/environment/with_modules.rb +27 -19
  29. data/lib/r10k/forge/module_release.rb +2 -2
  30. data/lib/r10k/git.rb +1 -0
  31. data/lib/r10k/git/cache.rb +12 -4
  32. data/lib/r10k/git/rugged/credentials.rb +32 -2
  33. data/lib/r10k/git/stateful_repository.rb +4 -0
  34. data/lib/r10k/initializers.rb +2 -0
  35. data/lib/r10k/module/base.rb +8 -0
  36. data/lib/r10k/module/forge.rb +1 -1
  37. data/lib/r10k/module/git.rb +20 -3
  38. data/lib/r10k/puppetfile.rb +30 -12
  39. data/lib/r10k/settings.rb +24 -2
  40. data/lib/r10k/source/git.rb +22 -2
  41. data/lib/r10k/version.rb +1 -1
  42. data/locales/r10k.pot +60 -36
  43. data/spec/fixtures/unit/action/r10k_creds.yaml +9 -0
  44. data/spec/shared-examples/subprocess-runner.rb +11 -5
  45. data/spec/unit/action/deploy/environment_spec.rb +43 -2
  46. data/spec/unit/action/deploy/module_spec.rb +40 -1
  47. data/spec/unit/action/puppetfile/install_spec.rb +1 -0
  48. data/spec/unit/action/runner_spec.rb +48 -1
  49. data/spec/unit/environment/git_spec.rb +3 -2
  50. data/spec/unit/environment/with_modules_spec.rb +74 -0
  51. data/spec/unit/forge/module_release_spec.rb +14 -10
  52. data/spec/unit/git/cache_spec.rb +10 -0
  53. data/spec/unit/git/rugged/credentials_spec.rb +69 -2
  54. data/spec/unit/git_spec.rb +3 -3
  55. data/spec/unit/module/git_spec.rb +55 -0
  56. data/spec/unit/puppetfile_spec.rb +61 -7
  57. data/spec/unit/settings_spec.rb +12 -0
  58. data/spec/unit/source/git_spec.rb +49 -1
  59. metadata +6 -2
@@ -41,6 +41,10 @@ class R10K::Source::Git < R10K::Source::Base
41
41
  # that will be deployed as environments.
42
42
  attr_reader :ignore_branch_prefixes
43
43
 
44
+ # @!attribute [r] filter_command
45
+ # @return [String] Command to run to filter branches
46
+ attr_reader :filter_command
47
+
44
48
  # Initialize the given source.
45
49
  #
46
50
  # @param name [String] The identifier for this source.
@@ -61,6 +65,7 @@ class R10K::Source::Git < R10K::Source::Base
61
65
  @remote = options[:remote]
62
66
  @invalid_branches = (options[:invalid_branches] || 'correct_and_warn')
63
67
  @ignore_branch_prefixes = options[:ignore_branch_prefixes]
68
+ @filter_command = options[:filter_command]
64
69
 
65
70
  @cache = R10K::Git.cache.generate(@remote)
66
71
  end
@@ -115,7 +120,7 @@ class R10K::Source::Git < R10K::Source::Base
115
120
  environments.map {|env| env.dirname }
116
121
  end
117
122
 
118
- def filter_branches(branches, ignore_prefixes)
123
+ def filter_branches_by_regexp(branches, ignore_prefixes)
119
124
  filter = Regexp.new("^#{Regexp.union(ignore_prefixes)}")
120
125
  branches = branches.reject do |branch|
121
126
  result = filter.match(branch)
@@ -127,14 +132,29 @@ class R10K::Source::Git < R10K::Source::Base
127
132
  branches
128
133
  end
129
134
 
135
+ def filter_branches_by_command(branches, command)
136
+ branches.select do |branch|
137
+ result = system({'GIT_DIR' => @cache.git_dir.to_s, 'R10K_BRANCH' => branch, 'R10K_NAME' => @name.to_s}, command)
138
+ unless result
139
+ logger.warn _("Branch `%{name}:%{branch}` filtered out by filter_command %{cmd}") % {name: @name, branch: branch, cmd: command}
140
+ end
141
+ result
142
+ end
143
+ end
144
+
130
145
  private
131
146
 
132
147
  def branch_names
133
148
  opts = {:prefix => @prefix, :invalid => @invalid_branches, :source => @name}
134
149
  branches = @cache.branches
135
150
  if @ignore_branch_prefixes && !@ignore_branch_prefixes.empty?
136
- branches = filter_branches(branches, @ignore_branch_prefixes)
151
+ branches = filter_branches_by_regexp(branches, @ignore_branch_prefixes)
152
+ end
153
+
154
+ if @filter_command && !@filter_command.empty?
155
+ branches = filter_branches_by_command(branches, @filter_command)
137
156
  end
157
+
138
158
  branches.map do |branch|
139
159
  R10K::Environment::Name.new(branch, opts)
140
160
  end
data/lib/r10k/version.rb CHANGED
@@ -2,5 +2,5 @@ module R10K
2
2
  # When updating to a new major (X) or minor (Y) version, include `#major` or
3
3
  # `#minor` (respectively) in your commit message to trigger the appropriate
4
4
  # release. Otherwise, a new patch (Z) version will be released.
5
- VERSION = '3.5.0'
5
+ VERSION = '3.8.0'
6
6
  end
data/locales/r10k.pot CHANGED
@@ -1,16 +1,16 @@
1
1
  # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2020 Puppet, Inc.
2
+ # Copyright (C) 2021 Puppet, Inc.
3
3
  # This file is distributed under the same license as the r10k package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, 2020.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: r10k 3.4.1-20-g8fe925b\n"
9
+ "Project-Id-Version: r10k 3.4.1-133-g2007a86\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
12
- "POT-Creation-Date: 2020-04-28 18:41+0000\n"
13
- "PO-Revision-Date: 2020-04-28 18:41+0000\n"
12
+ "POT-Creation-Date: 2021-02-12 02:00+0000\n"
13
+ "PO-Revision-Date: 2021-02-12 02:00+0000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -83,15 +83,15 @@ msgstr ""
83
83
  msgid "Cannot track control repo branch for content '%{name}' when not part of a 'deploy' action, will use default if available."
84
84
  msgstr ""
85
85
 
86
- #: ../lib/r10k/action/runner.rb:53 ../lib/r10k/deployment/config.rb:42
86
+ #: ../lib/r10k/action/runner.rb:54 ../lib/r10k/deployment/config.rb:42
87
87
  msgid "Overriding config file setting '%{key}': '%{old_val}' -> '%{new_val}'"
88
88
  msgstr ""
89
89
 
90
- #: ../lib/r10k/action/runner.rb:86
90
+ #: ../lib/r10k/action/runner.rb:91
91
91
  msgid "Reading configuration from %{config_path}"
92
92
  msgstr ""
93
93
 
94
- #: ../lib/r10k/action/runner.rb:89
94
+ #: ../lib/r10k/action/runner.rb:94
95
95
  msgid "No config file explicitly given and no default config file could be found, default settings will be used."
96
96
  msgstr ""
97
97
 
@@ -107,12 +107,16 @@ msgstr ""
107
107
  msgid "%{class} has not implemented method %{method}"
108
108
  msgstr ""
109
109
 
110
- #: ../lib/r10k/environment/with_modules.rb:104
111
- msgid "Puppetfile cannot contain module names defined by environment %{name}"
110
+ #: ../lib/r10k/environment/with_modules.rb:60
111
+ msgid "Environment and %{src} both define the \"%{name}\" module"
112
112
  msgstr ""
113
113
 
114
- #: ../lib/r10k/environment/with_modules.rb:106
115
- msgid "Remove the conflicting definitions of the following modules: %{conflicts}"
114
+ #: ../lib/r10k/environment/with_modules.rb:61
115
+ msgid "#{msg_error}. The %{src} definition will be ignored"
116
+ msgstr ""
117
+
118
+ #: ../lib/r10k/environment/with_modules.rb:71
119
+ msgid "Unexpected value for `module_conflicts` setting in %{env} environment: %{val}"
116
120
  msgstr ""
117
121
 
118
122
  #: ../lib/r10k/feature.rb:27
@@ -187,11 +191,11 @@ msgstr ""
187
191
  msgid "Cannot write %{file}; parent directory does not exist"
188
192
  msgstr ""
189
193
 
190
- #: ../lib/r10k/git/cache.rb:55
194
+ #: ../lib/r10k/git/cache.rb:65
191
195
  msgid "%{class}#path is deprecated; use #git_dir"
192
196
  msgstr ""
193
197
 
194
- #: ../lib/r10k/git/cache.rb:84
198
+ #: ../lib/r10k/git/cache.rb:94
195
199
  msgid "Creating new git cache for %{remote}"
196
200
  msgstr ""
197
201
 
@@ -227,15 +231,31 @@ msgstr ""
227
231
  msgid "Unable to use SSH key auth for %{url}: private key %{private_key} is missing or unreadable"
228
232
  msgstr ""
229
233
 
230
- #: ../lib/r10k/git/rugged/credentials.rb:80
234
+ #: ../lib/r10k/git/rugged/credentials.rb:72
235
+ msgid "Using OAuth token from stdin for URL %{url}"
236
+ msgstr ""
237
+
238
+ #: ../lib/r10k/git/rugged/credentials.rb:75
239
+ msgid "Using OAuth token from %{token_path} for URL %{url}"
240
+ msgstr ""
241
+
242
+ #: ../lib/r10k/git/rugged/credentials.rb:77
243
+ msgid "%{path} is missing or unreadable, cannot load OAuth token"
244
+ msgstr ""
245
+
246
+ #: ../lib/r10k/git/rugged/credentials.rb:81
247
+ msgid "Supplied OAuth token contains invalid characters."
248
+ msgstr ""
249
+
250
+ #: ../lib/r10k/git/rugged/credentials.rb:110
231
251
  msgid "URL %{url} includes the username %{username}, using that user for authentication."
232
252
  msgstr ""
233
253
 
234
- #: ../lib/r10k/git/rugged/credentials.rb:83
254
+ #: ../lib/r10k/git/rugged/credentials.rb:113
235
255
  msgid "URL %{url} did not specify a user, using %{user} from configuration"
236
256
  msgstr ""
237
257
 
238
- #: ../lib/r10k/git/rugged/credentials.rb:86
258
+ #: ../lib/r10k/git/rugged/credentials.rb:116
239
259
  msgid "URL %{url} did not specify a user, using current user %{user}"
240
260
  msgstr ""
241
261
 
@@ -255,31 +275,31 @@ msgstr ""
255
275
  msgid "Found local modifications in %{file_path}"
256
276
  msgstr ""
257
277
 
258
- #: ../lib/r10k/git/stateful_repository.rb:40
278
+ #: ../lib/r10k/git/stateful_repository.rb:44
259
279
  msgid "Unable to sync repo to unresolvable ref '%{ref}'"
260
280
  msgstr ""
261
281
 
262
- #: ../lib/r10k/git/stateful_repository.rb:47
282
+ #: ../lib/r10k/git/stateful_repository.rb:51
263
283
  msgid "Cloning %{repo_path} and checking out %{ref}"
264
284
  msgstr ""
265
285
 
266
- #: ../lib/r10k/git/stateful_repository.rb:50
286
+ #: ../lib/r10k/git/stateful_repository.rb:54
267
287
  msgid "Replacing %{repo_path} and checking out %{ref}"
268
288
  msgstr ""
269
289
 
270
- #: ../lib/r10k/git/stateful_repository.rb:54 ../lib/r10k/git/stateful_repository.rb:59
290
+ #: ../lib/r10k/git/stateful_repository.rb:58 ../lib/r10k/git/stateful_repository.rb:63
271
291
  msgid "Updating %{repo_path} to %{ref}"
272
292
  msgstr ""
273
293
 
274
- #: ../lib/r10k/git/stateful_repository.rb:58
294
+ #: ../lib/r10k/git/stateful_repository.rb:62
275
295
  msgid "Overwriting local modifications to %{repo_path}"
276
296
  msgstr ""
277
297
 
278
- #: ../lib/r10k/git/stateful_repository.rb:62
298
+ #: ../lib/r10k/git/stateful_repository.rb:66
279
299
  msgid "Skipping %{repo_path} due to local modifications"
280
300
  msgstr ""
281
301
 
282
- #: ../lib/r10k/git/stateful_repository.rb:65
302
+ #: ../lib/r10k/git/stateful_repository.rb:69
283
303
  msgid "%{repo_path} is already at Git ref %{ref}"
284
304
  msgstr ""
285
305
 
@@ -303,7 +323,7 @@ msgstr ""
303
323
  msgid "Module %{name} with args %{args} doesn't have an implementation. (Are you using the right arguments?)"
304
324
  msgstr ""
305
325
 
306
- #: ../lib/r10k/module/base.rb:110
326
+ #: ../lib/r10k/module/base.rb:118
307
327
  msgid "Module name (%{title}) must match either 'modulename' or 'owner/modulename'"
308
328
  msgstr ""
309
329
 
@@ -312,10 +332,10 @@ msgid "The module %{title} does not exist on %{url}."
312
332
  msgstr ""
313
333
 
314
334
  #: ../lib/r10k/module/forge.rb:174
315
- msgid "Forge module names must match 'owner/modulename'"
335
+ msgid "Forge module names must match 'owner/modulename', instead got #{title}"
316
336
  msgstr ""
317
337
 
318
- #: ../lib/r10k/module/git.rb:97
338
+ #: ../lib/r10k/module/git.rb:113
319
339
  msgid "Unhandled options %{unhandled} specified for %{class}"
320
340
  msgstr ""
321
341
 
@@ -347,19 +367,19 @@ msgstr ""
347
367
  msgid "Remove the duplicates of the following modules: %{dupes}"
348
368
  msgstr ""
349
369
 
350
- #: ../lib/r10k/puppetfile.rb:192
370
+ #: ../lib/r10k/puppetfile.rb:201
351
371
  msgid "Updating modules with %{pool_size} threads"
352
372
  msgstr ""
353
373
 
354
- #: ../lib/r10k/puppetfile.rb:203
374
+ #: ../lib/r10k/puppetfile.rb:212
355
375
  msgid "Error during concurrent deploy of a module: %{message}"
356
376
  msgstr ""
357
377
 
358
- #: ../lib/r10k/puppetfile.rb:225
378
+ #: ../lib/r10k/puppetfile.rb:241
359
379
  msgid "Module thread %{id} exiting: %{message}"
360
380
  msgstr ""
361
381
 
362
- #: ../lib/r10k/puppetfile.rb:282
382
+ #: ../lib/r10k/puppetfile.rb:300
363
383
  msgid "unrecognized declaration '%{method}'"
364
384
  msgstr ""
365
385
 
@@ -442,26 +462,30 @@ msgid ""
442
462
  "Returned: %{data}"
443
463
  msgstr ""
444
464
 
445
- #: ../lib/r10k/source/git.rb:72
465
+ #: ../lib/r10k/source/git.rb:77
446
466
  msgid "Fetching '%{remote}' to determine current branches."
447
467
  msgstr ""
448
468
 
449
- #: ../lib/r10k/source/git.rb:75
469
+ #: ../lib/r10k/source/git.rb:80
450
470
  msgid "Unable to determine current branches for Git source '%{name}' (%{basedir})"
451
471
  msgstr ""
452
472
 
453
- #: ../lib/r10k/source/git.rb:100
473
+ #: ../lib/r10k/source/git.rb:105
454
474
  msgid "Environment %{env_name} contained non-word characters, correcting name to %{corrected_env_name}"
455
475
  msgstr ""
456
476
 
457
- #: ../lib/r10k/source/git.rb:104
477
+ #: ../lib/r10k/source/git.rb:109
458
478
  msgid "Environment %{env_name} contained non-word characters, ignoring it."
459
479
  msgstr ""
460
480
 
461
- #: ../lib/r10k/source/git.rb:123 ../lib/r10k/source/svn.rb:113
481
+ #: ../lib/r10k/source/git.rb:128 ../lib/r10k/source/svn.rb:113
462
482
  msgid "Branch %{branch} filtered out by ignore_branch_prefixes %{ibp}"
463
483
  msgstr ""
464
484
 
485
+ #: ../lib/r10k/source/git.rb:139
486
+ msgid "Branch `%{name}:%{branch}` filtered out by filter_command %{cmd}"
487
+ msgstr ""
488
+
465
489
  #: ../lib/r10k/source/yaml.rb:10
466
490
  msgid "Couldn't open environments file %{file}: %{err}"
467
491
  msgstr ""
@@ -0,0 +1,9 @@
1
+ ---
2
+ git:
3
+ private_key: '/global/config/private/key'
4
+ oauth_token: '/global/config/oauth/token'
5
+ repositories:
6
+ - remote: 'git@myfakegitserver.com:user/repo.git'
7
+ private_key: '/config/private/key'
8
+ - remote: 'https://myfakegitserver.com/user/repo.git'
9
+ oauth_token: '/config/oauth/token'
@@ -32,23 +32,29 @@ shared_examples_for "a subprocess runner" do |fixture_root|
32
32
  end
33
33
  end
34
34
 
35
- describe "running 'ls' with a different working directory" do
35
+ describe "running 'ls' or 'dir' with a different working directory" do
36
36
  subject do
37
- described_class.new(%w[ls]).tap do |o|
38
- o.cwd = fixture_root
37
+ if R10K::Util::Platform.windows?
38
+ described_class.new(%w[cmd /c dir]).tap do |o|
39
+ o.cwd = fixture_root
40
+ end
41
+ else
42
+ described_class.new(%w[ls]).tap do |o|
43
+ o.cwd = fixture_root
44
+ end
39
45
  end
40
46
  end
41
47
 
42
48
  it "returns the contents of the given working directory" do
43
49
  result = subject.run
44
- expect(result.stdout).to eq 'no-execute.sh'
50
+ expect(result.stdout).to match('no-execute.sh')
45
51
  end
46
52
  end
47
53
 
48
54
  describe "running 'false'" do
49
55
  subject { described_class.new(%w[false]) }
50
56
 
51
- it "sets the exit code to 1" do
57
+ it "sets the exit code to 1", unless: R10K::Util::Platform.windows? do
52
58
  result = subject.run
53
59
  expect(result.exit_code).to eq 1
54
60
  end
@@ -27,8 +27,6 @@ describe R10K::Action::Deploy::Environment do
27
27
  described_class.new({:'no-force' => true}, [])
28
28
  end
29
29
 
30
- it "normalizes environment names in the arg vector"
31
-
32
30
  it 'can accept a generate-types option' do
33
31
  described_class.new({ 'generate-types': true }, [])
34
32
  end
@@ -36,6 +34,14 @@ describe R10K::Action::Deploy::Environment do
36
34
  it 'can accept a puppet-path option' do
37
35
  described_class.new({ 'puppet-path': '/nonexistent' }, [])
38
36
  end
37
+
38
+ it 'can accept a private-key option' do
39
+ described_class.new({ 'private-key': '/nonexistent' }, [])
40
+ end
41
+
42
+ it 'can accept a token option' do
43
+ described_class.new({ 'oauth-token': '/nonexistent' }, [])
44
+ end
39
45
  end
40
46
 
41
47
  describe "when called" do
@@ -162,6 +168,13 @@ describe R10K::Action::Deploy::Environment do
162
168
  end
163
169
  end
164
170
 
171
+ describe 'extracting credentials' do
172
+ let(:deployment) do
173
+ R10K::Deployment.new(mock_config)
174
+ end
175
+
176
+ end
177
+
165
178
  describe "purge_levels" do
166
179
  let(:settings) { { deploy: { purge_levels: purge_levels } } }
167
180
 
@@ -219,6 +232,7 @@ describe R10K::Action::Deploy::Environment do
219
232
  end
220
233
  end
221
234
  end
235
+
222
236
  describe "generate-types" do
223
237
  let(:deployment) do
224
238
  R10K::Deployment.new(
@@ -331,6 +345,33 @@ describe R10K::Action::Deploy::Environment do
331
345
  expect(subject.instance_variable_get(:@puppet_path)).to eq('/nonexistent')
332
346
  end
333
347
  end
348
+
349
+ describe 'with puppet-conf' do
350
+
351
+ subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-conf': '/nonexistent' }, []) }
352
+
353
+ it 'sets puppet_conf' do
354
+ expect(subject.instance_variable_get(:@puppet_conf)).to eq('/nonexistent')
355
+ end
356
+ end
357
+
358
+ describe 'with private-key' do
359
+
360
+ subject { described_class.new({ config: '/some/nonexistent/path', 'private-key': '/nonexistent' }, []) }
361
+
362
+ it 'sets private_key' do
363
+ expect(subject.instance_variable_get(:@private_key)).to eq('/nonexistent')
364
+ end
365
+ end
366
+
367
+ describe 'with oauth-token' do
368
+
369
+ subject { described_class.new({ config: '/some/nonexistent/path', 'oauth-token': '/nonexistent' }, []) }
370
+
371
+ it 'sets oauth_token' do
372
+ expect(subject.instance_variable_get(:@oauth_token)).to eq('/nonexistent')
373
+ end
374
+ end
334
375
  end
335
376
 
336
377
  describe "write_environment_info!" do
@@ -26,9 +26,21 @@ describe R10K::Action::Deploy::Module do
26
26
  described_class.new({ 'puppet-path': '/nonexistent' }, [])
27
27
  end
28
28
 
29
+ it 'can accept a puppet-conf option' do
30
+ described_class.new({ 'puppet-conf': '/nonexistent' }, [])
31
+ end
32
+
29
33
  it 'can accept a cachedir option' do
30
34
  described_class.new({ cachedir: '/nonexistent' }, [])
31
35
  end
36
+
37
+ it 'can accept a private-key option' do
38
+ described_class.new({ 'private-key': '/nonexistent' }, [])
39
+ end
40
+
41
+ it 'can accept a token option' do
42
+ described_class.new({ 'oauth-token': '/nonexistent' }, [])
43
+ end
32
44
  end
33
45
 
34
46
  describe "with no-force" do
@@ -128,12 +140,39 @@ describe R10K::Action::Deploy::Module do
128
140
  end
129
141
  end
130
142
 
143
+ describe 'with puppet-conf' do
144
+
145
+ subject { described_class.new({ config: '/some/nonexistent/path', 'puppet-conf': '/nonexistent' }, []) }
146
+
147
+ it 'sets puppet_conf' do
148
+ expect(subject.instance_variable_get(:@puppet_conf)).to eq('/nonexistent')
149
+ end
150
+ end
151
+
131
152
  describe 'with cachedir' do
132
153
 
133
154
  subject { described_class.new({ config: '/some/nonexistent/path', cachedir: '/nonexistent' }, []) }
134
155
 
135
- it 'sets puppet_path' do
156
+ it 'sets cachedir' do
136
157
  expect(subject.instance_variable_get(:@cachedir)).to eq('/nonexistent')
137
158
  end
138
159
  end
160
+
161
+ describe 'with private-key' do
162
+
163
+ subject { described_class.new({ config: '/some/nonexistent/path', 'private-key': '/nonexistent' }, []) }
164
+
165
+ it 'sets private_key' do
166
+ expect(subject.instance_variable_get(:@private_key)).to eq('/nonexistent')
167
+ end
168
+ end
169
+
170
+ describe 'with oauth-token' do
171
+
172
+ subject { described_class.new({ config: '/some/nonexistent/path', 'oauth-token': '/nonexistent' }, []) }
173
+
174
+ it 'sets token_path' do
175
+ expect(subject.instance_variable_get(:@oauth_token)).to eq('/nonexistent')
176
+ end
177
+ end
139
178
  end