beaker 3.37.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -1
  3. data/acceptance/lib/helpers/test_helper.rb +0 -28
  4. data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -1
  5. data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
  6. data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +106 -103
  7. data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
  8. data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +1 -50
  9. data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
  10. data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +71 -27
  11. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +3 -3
  12. data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -3
  13. data/acceptance/tests/base/host/file_test.rb +81 -0
  14. data/beaker.gemspec +6 -14
  15. data/docs/how_to/install_puppet.md +2 -0
  16. data/docs/how_to/the_beaker_dsl.md +150 -150
  17. data/docs/how_to/upgrade_from_3_to_4.md +52 -0
  18. data/lib/beaker.rb +0 -10
  19. data/lib/beaker/dsl.rb +7 -0
  20. data/lib/beaker/dsl/helpers.rb +4 -6
  21. data/lib/beaker/dsl/helpers/host_helpers.rb +10 -34
  22. data/lib/beaker/dsl/install_utils.rb +0 -5
  23. data/lib/beaker/dsl/roles.rb +1 -1
  24. data/lib/beaker/host.rb +12 -11
  25. data/lib/beaker/host/aix/file.rb +2 -2
  26. data/lib/beaker/host/aix/group.rb +1 -0
  27. data/lib/beaker/host/aix/user.rb +1 -0
  28. data/lib/beaker/host/freebsd/pkg.rb +9 -0
  29. data/lib/beaker/host/mac/group.rb +1 -0
  30. data/lib/beaker/host/mac/user.rb +8 -13
  31. data/lib/beaker/host/pswindows/file.rb +2 -2
  32. data/lib/beaker/host/pswindows/group.rb +1 -0
  33. data/lib/beaker/host/pswindows/user.rb +1 -0
  34. data/lib/beaker/host/unix/exec.rb +5 -5
  35. data/lib/beaker/host/unix/file.rb +43 -2
  36. data/lib/beaker/host/unix/group.rb +1 -0
  37. data/lib/beaker/host/unix/user.rb +1 -0
  38. data/lib/beaker/host/windows/file.rb +32 -2
  39. data/lib/beaker/host/windows/group.rb +1 -0
  40. data/lib/beaker/host/windows/user.rb +1 -0
  41. data/lib/beaker/host_prebuilt_steps.rb +0 -4
  42. data/lib/beaker/hypervisor.rb +1 -5
  43. data/lib/beaker/result.rb +4 -0
  44. data/lib/beaker/version.rb +1 -1
  45. data/spec/beaker/dsl/helpers/host_helpers_spec.rb +14 -51
  46. data/spec/beaker/dsl/wrappers_spec.rb +0 -46
  47. data/spec/beaker/host/mac/user_spec.rb +5 -8
  48. data/spec/beaker/host/unix/exec_spec.rb +1 -1
  49. data/spec/beaker/host/unix/file_spec.rb +39 -0
  50. data/spec/beaker/host/windows/file_spec.rb +55 -0
  51. data/spec/beaker/host_prebuilt_steps_spec.rb +16 -67
  52. data/spec/beaker/host_spec.rb +10 -14
  53. data/spec/beaker/hypervisor/hypervisor_spec.rb +1 -1
  54. metadata +47 -165
  55. data/acceptance/lib/beaker/acceptance/install_utils.rb +0 -58
  56. data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +0 -68
  57. data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +0 -49
  58. data/lib/beaker/dsl/helpers/facter_helpers.rb +0 -57
  59. data/lib/beaker/dsl/install_utils/pe_defaults.rb +0 -143
  60. data/lib/beaker/dsl/install_utils/windows_utils.rb +0 -223
  61. data/spec/beaker/dsl/ezbake_utils_spec.rb +0 -279
  62. data/spec/beaker/dsl/install_utils/pe_defaults_spec.rb +0 -61
  63. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +0 -263
@@ -608,16 +608,14 @@ module Beaker
608
608
  @options = { :logger => logger }
609
609
  args = [ 'source', 'target', {:ignore => ['.bundle']} ]
610
610
 
611
- key = host['ssh']['keys']
612
- if key.is_a? Array
613
- key = key.first
614
- end
611
+ key = host['ssh']['keys'].first
612
+ expect( File ).to receive( :exist? ).with( key ).and_return true
615
613
 
616
614
  rsync_args = [ 'source', 'target', ['-az', "-e \"ssh -i #{key} -p 22 -o 'StrictHostKeyChecking no'\"", "--exclude '.bundle'"] ]
617
615
 
618
616
  expect( host ).to receive(:reachable_name).and_return('default.ip.address')
619
617
 
620
- expect( Rsync ).to receive(:run).with( *rsync_args ).and_return(Beaker::Result.new(host, 'output!'))
618
+ expect( Rsync ).to receive(:run).with( *rsync_args ).and_return(Rsync::Result.new('raw rsync output', 0))
621
619
 
622
620
  host.do_rsync_to *args
623
621
 
@@ -637,8 +635,8 @@ module Beaker
637
635
  FileUtils.mkdir_p('/var/folders/v0/')
638
636
  FileUtils.touch('/var/folders/v0/centos-64-x6420150625-48025-lu3u86')
639
637
  rsync_args = [ 'source', 'target', ['-az', "-e \"ssh -F /var/folders/v0/centos-64-x6420150625-48025-lu3u86 -o 'StrictHostKeyChecking no'\"", "--exclude '.bundle'"] ]
640
- expect(Rsync).to receive(:run).with(*rsync_args).and_return(Beaker::Result.new(host, 'output!'))
641
- expect(host.do_rsync_to(*args).cmd).to eq('output!')
638
+ expect(Rsync).to receive(:run).with(*rsync_args).and_return(Rsync::Result.new('raw rsync output', 0))
639
+ expect(host.do_rsync_to(*args).success?).to eq(true)
642
640
  end
643
641
 
644
642
  it 'does not use the ssh config file when config does not exist' do
@@ -647,8 +645,8 @@ module Beaker
647
645
  args = [ 'source', 'target',
648
646
  {:ignore => ['.bundle']} ]
649
647
  rsync_args = [ 'source', 'target', ['-az', "-e \"ssh -o 'StrictHostKeyChecking no'\"", "--exclude '.bundle'"] ]
650
- expect(Rsync).to receive(:run).with(*rsync_args).and_return(Beaker::Result.new(host, 'output!'))
651
- expect(host.do_rsync_to(*args).cmd).to eq('output!')
648
+ expect(Rsync).to receive(:run).with(*rsync_args).and_return(Rsync::Result.new('raw rsync output', 0))
649
+ expect(host.do_rsync_to(*args).success?).to eq(true)
652
650
  end
653
651
 
654
652
  it "doesn't corrupt :ignore option" do
@@ -657,13 +655,11 @@ module Beaker
657
655
  ignore_list = ['.bundle']
658
656
  args = ['source', 'target', {:ignore => ignore_list}]
659
657
 
660
- key = host['ssh']['keys']
661
- if key.is_a? Array
662
- key = key.first
663
- end
658
+ key = host['ssh']['keys'].first
659
+ expect( File ).to receive( :exist? ).with( key ).twice.and_return true
664
660
 
665
661
  rsync_args = ['source', 'target', ['-az', "-e \"ssh -i #{key} -p 22 -o 'StrictHostKeyChecking no'\"", "--exclude '.bundle'"]]
666
- expect(Rsync).to receive(:run).twice.with(*rsync_args).and_return(Beaker::Result.new(host, 'output!'))
662
+ expect(Rsync).to receive(:run).twice.with(*rsync_args).and_return(Rsync::Result.new('raw rsync output', 0))
667
663
 
668
664
  host.do_rsync_to *args
669
665
  host.do_rsync_to *args
@@ -9,7 +9,7 @@ module Beaker
9
9
 
10
10
  it "includes custom hypervisor and call set_ssh_connection_preference" do
11
11
  allow(hypervisor).to receive(:set_ssh_connection_preference).with([], hypervisor)
12
- expect{ hypervisor.create('custom_hypervisor', [], make_opts() )}.to raise_error(RuntimeError, "Invalid hypervisor: custom_hypervisor")
12
+ expect{ hypervisor.create('custom_hypervisor', [], make_opts() )}.to raise_error(LoadError, "cannot load such file -- beaker/hypervisor/custom_hypervisor")
13
13
  end
14
14
 
15
15
  it "sets ssh connection preference if connection_preference method is not overwritten" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.37.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -86,6 +86,48 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '10.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: beaker-aws
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '0.1'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.1'
103
+ - !ruby/object:Gem::Dependency
104
+ name: beaker-abs
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.4'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.4'
117
+ - !ruby/object:Gem::Dependency
118
+ name: beaker-vmpooler
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.0'
89
131
  - !ruby/object:Gem::Dependency
90
132
  name: yard
91
133
  requirement: !ruby/object:Gem::Requirement
@@ -282,20 +324,6 @@ dependencies:
282
324
  - - "~>"
283
325
  - !ruby/object:Gem::Version
284
326
  version: '0.0'
285
- - !ruby/object:Gem::Dependency
286
- name: beaker-hiera
287
- requirement: !ruby/object:Gem::Requirement
288
- requirements:
289
- - - "~>"
290
- - !ruby/object:Gem::Version
291
- version: '0.0'
292
- type: :runtime
293
- prerelease: false
294
- version_requirements: !ruby/object:Gem::Requirement
295
- requirements:
296
- - - "~>"
297
- - !ruby/object:Gem::Version
298
- version: '0.0'
299
327
  - !ruby/object:Gem::Dependency
300
328
  name: beaker-hostgenerator
301
329
  requirement: !ruby/object:Gem::Requirement
@@ -310,146 +338,6 @@ dependencies:
310
338
  - - ">="
311
339
  - !ruby/object:Gem::Version
312
340
  version: '0'
313
- - !ruby/object:Gem::Dependency
314
- name: beaker-puppet
315
- requirement: !ruby/object:Gem::Requirement
316
- requirements:
317
- - - "~>"
318
- - !ruby/object:Gem::Version
319
- version: '0.0'
320
- type: :runtime
321
- prerelease: false
322
- version_requirements: !ruby/object:Gem::Requirement
323
- requirements:
324
- - - "~>"
325
- - !ruby/object:Gem::Version
326
- version: '0.0'
327
- - !ruby/object:Gem::Dependency
328
- name: beaker-docker
329
- requirement: !ruby/object:Gem::Requirement
330
- requirements:
331
- - - "~>"
332
- - !ruby/object:Gem::Version
333
- version: '0.1'
334
- type: :runtime
335
- prerelease: false
336
- version_requirements: !ruby/object:Gem::Requirement
337
- requirements:
338
- - - "~>"
339
- - !ruby/object:Gem::Version
340
- version: '0.1'
341
- - !ruby/object:Gem::Dependency
342
- name: beaker-aws
343
- requirement: !ruby/object:Gem::Requirement
344
- requirements:
345
- - - "~>"
346
- - !ruby/object:Gem::Version
347
- version: '0.1'
348
- type: :runtime
349
- prerelease: false
350
- version_requirements: !ruby/object:Gem::Requirement
351
- requirements:
352
- - - "~>"
353
- - !ruby/object:Gem::Version
354
- version: '0.1'
355
- - !ruby/object:Gem::Dependency
356
- name: beaker-abs
357
- requirement: !ruby/object:Gem::Requirement
358
- requirements:
359
- - - "~>"
360
- - !ruby/object:Gem::Version
361
- version: '0.4'
362
- type: :runtime
363
- prerelease: false
364
- version_requirements: !ruby/object:Gem::Requirement
365
- requirements:
366
- - - "~>"
367
- - !ruby/object:Gem::Version
368
- version: '0.4'
369
- - !ruby/object:Gem::Dependency
370
- name: beaker-vmpooler
371
- requirement: !ruby/object:Gem::Requirement
372
- requirements:
373
- - - "~>"
374
- - !ruby/object:Gem::Version
375
- version: '1.0'
376
- type: :runtime
377
- prerelease: false
378
- version_requirements: !ruby/object:Gem::Requirement
379
- requirements:
380
- - - "~>"
381
- - !ruby/object:Gem::Version
382
- version: '1.0'
383
- - !ruby/object:Gem::Dependency
384
- name: beaker-google
385
- requirement: !ruby/object:Gem::Requirement
386
- requirements:
387
- - - "~>"
388
- - !ruby/object:Gem::Version
389
- version: '0.1'
390
- type: :runtime
391
- prerelease: false
392
- version_requirements: !ruby/object:Gem::Requirement
393
- requirements:
394
- - - "~>"
395
- - !ruby/object:Gem::Version
396
- version: '0.1'
397
- - !ruby/object:Gem::Dependency
398
- name: beaker-vagrant
399
- requirement: !ruby/object:Gem::Requirement
400
- requirements:
401
- - - "~>"
402
- - !ruby/object:Gem::Version
403
- version: '0.1'
404
- type: :runtime
405
- prerelease: false
406
- version_requirements: !ruby/object:Gem::Requirement
407
- requirements:
408
- - - "~>"
409
- - !ruby/object:Gem::Version
410
- version: '0.1'
411
- - !ruby/object:Gem::Dependency
412
- name: beaker-vmware
413
- requirement: !ruby/object:Gem::Requirement
414
- requirements:
415
- - - "~>"
416
- - !ruby/object:Gem::Version
417
- version: '0.1'
418
- type: :runtime
419
- prerelease: false
420
- version_requirements: !ruby/object:Gem::Requirement
421
- requirements:
422
- - - "~>"
423
- - !ruby/object:Gem::Version
424
- version: '0.1'
425
- - !ruby/object:Gem::Dependency
426
- name: beaker-openstack
427
- requirement: !ruby/object:Gem::Requirement
428
- requirements:
429
- - - "~>"
430
- - !ruby/object:Gem::Version
431
- version: '0.1'
432
- type: :runtime
433
- prerelease: false
434
- version_requirements: !ruby/object:Gem::Requirement
435
- requirements:
436
- - - "~>"
437
- - !ruby/object:Gem::Version
438
- version: '0.1'
439
- - !ruby/object:Gem::Dependency
440
- name: beaker-vcloud
441
- requirement: !ruby/object:Gem::Requirement
442
- requirements:
443
- - - "~>"
444
- - !ruby/object:Gem::Version
445
- version: '0.1'
446
- type: :runtime
447
- prerelease: false
448
- version_requirements: !ruby/object:Gem::Requirement
449
- requirements:
450
- - - "~>"
451
- - !ruby/object:Gem::Version
452
- version: '0.1'
453
341
  description: Puppet's accceptance testing harness
454
342
  email:
455
343
  - delivery@puppet.com
@@ -529,7 +417,6 @@ files:
529
417
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-x86_64.repo
530
418
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-24-x86_64.repo
531
419
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-sles-12-x86_64.repo
532
- - acceptance/lib/beaker/acceptance/install_utils.rb
533
420
  - acceptance/lib/helpers/test_helper.rb
534
421
  - acceptance/pre_suite/README.md
535
422
  - acceptance/pre_suite/pe/install.rb
@@ -544,7 +431,6 @@ files:
544
431
  - acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb
545
432
  - acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb
546
433
  - acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb
547
- - acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb
548
434
  - acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb
549
435
  - acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb
550
436
  - acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb
@@ -560,10 +446,10 @@ files:
560
446
  - acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb
561
447
  - acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb
562
448
  - acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb
563
- - acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb
564
449
  - acceptance/tests/base/dsl/platform_tag_confiner_test.rb
565
450
  - acceptance/tests/base/dsl/structure_test.rb
566
451
  - acceptance/tests/base/external_resources_test.rb
452
+ - acceptance/tests/base/host/file_test.rb
567
453
  - acceptance/tests/base/host/group_test.rb
568
454
  - acceptance/tests/base/host/host_test.rb
569
455
  - acceptance/tests/base/host/packages.rb
@@ -617,6 +503,7 @@ files:
617
503
  - docs/how_to/test_arbitrary_beaker_versions.md
618
504
  - docs/how_to/the_beaker_dsl.md
619
505
  - docs/how_to/upgrade_from_2_to_3.md
506
+ - docs/how_to/upgrade_from_3_to_4.md
620
507
  - docs/how_to/use_hocon_helpers.md
621
508
  - docs/how_to/use_user_password_authentication.md
622
509
  - docs/how_to/write_a_beaker_test_for_a_module.md
@@ -638,14 +525,11 @@ files:
638
525
  - lib/beaker/dsl.rb
639
526
  - lib/beaker/dsl/assertions.rb
640
527
  - lib/beaker/dsl/helpers.rb
641
- - lib/beaker/dsl/helpers/facter_helpers.rb
642
528
  - lib/beaker/dsl/helpers/hocon_helpers.rb
643
529
  - lib/beaker/dsl/helpers/host_helpers.rb
644
530
  - lib/beaker/dsl/helpers/test_helpers.rb
645
531
  - lib/beaker/dsl/helpers/web_helpers.rb
646
532
  - lib/beaker/dsl/install_utils.rb
647
- - lib/beaker/dsl/install_utils/pe_defaults.rb
648
- - lib/beaker/dsl/install_utils/windows_utils.rb
649
533
  - lib/beaker/dsl/outcomes.rb
650
534
  - lib/beaker/dsl/patterns.rb
651
535
  - lib/beaker/dsl/roles.rb
@@ -726,12 +610,9 @@ files:
726
610
  - spec/beaker/cli_spec.rb
727
611
  - spec/beaker/command_spec.rb
728
612
  - spec/beaker/dsl/assertions_spec.rb
729
- - spec/beaker/dsl/ezbake_utils_spec.rb
730
613
  - spec/beaker/dsl/helpers/host_helpers_spec.rb
731
614
  - spec/beaker/dsl/helpers/test_helpers_spec.rb
732
615
  - spec/beaker/dsl/helpers/web_helpers_spec.rb
733
- - spec/beaker/dsl/install_utils/pe_defaults_spec.rb
734
- - spec/beaker/dsl/install_utils/windows_utils_spec.rb
735
616
  - spec/beaker/dsl/outcomes_spec.rb
736
617
  - spec/beaker/dsl/roles_spec.rb
737
618
  - spec/beaker/dsl/structure_spec.rb
@@ -754,6 +635,7 @@ files:
754
635
  - spec/beaker/host/unix/pkg_spec.rb
755
636
  - spec/beaker/host/unix_spec.rb
756
637
  - spec/beaker/host/windows/exec_spec.rb
638
+ - spec/beaker/host/windows/file_spec.rb
757
639
  - spec/beaker/host/windows/group_spec.rb
758
640
  - spec/beaker/host/windows/pkg_spec.rb
759
641
  - spec/beaker/host/windows/user_spec.rb
@@ -1,58 +0,0 @@
1
- module Beaker
2
- module Acceptance
3
- module InstallUtils
4
-
5
- PLATFORM_PATTERNS = {
6
- :redhat => /fedora|el|centos/,
7
- :debian => /debian|ubuntu/,
8
- :debian_ruby18 => /debian|ubuntu-lucid|ubuntu-precise/,
9
- :solaris_10 => /solaris-10/,
10
- :solaris_11 => /solaris-11/,
11
- :windows => /windows/,
12
- :sles => /sles/,
13
- }.freeze
14
-
15
- # Installs packages on the hosts.
16
- #
17
- # @param hosts [Array<Host>] Array of hosts to install packages to.
18
- # @param package_hash [Hash{Symbol=>Array<String,Array<String,String>>}]
19
- # Keys should be a symbol for a platform in PLATFORM_PATTERNS. Values
20
- # should be an array of package names to install, or of two element
21
- # arrays where a[0] is the command we expect to find on the platform
22
- # and a[1] is the package name (when they are different).
23
- # @param options [Hash{Symbol=>Boolean}]
24
- # @option options [Boolean] :check_if_exists First check to see if
25
- # command is present before installing package. (Default false)
26
- # @return true
27
- def install_packages_on(hosts, package_hash, options = {})
28
- return true if hosts == nil
29
- check_if_exists = options[:check_if_exists]
30
- hosts = [hosts] unless hosts.kind_of?(Array)
31
- hosts.each do |host|
32
- package_hash.each do |platform_key,package_list|
33
- if pattern = PLATFORM_PATTERNS[platform_key]
34
- if pattern.match(host['platform'])
35
- package_list.each do |cmd_pkg|
36
- if cmd_pkg.kind_of?(Array)
37
- command, package = cmd_pkg
38
- else
39
- command = package = cmd_pkg
40
- end
41
- if !check_if_exists || !host.check_for_package(command)
42
- host.logger.notify("Installing #{package}")
43
- additional_switches = '--allow-unauthenticated' if platform_key == :debian
44
- host.install_package(package, additional_switches)
45
- end
46
- end
47
- end
48
- else
49
- raise("Unknown platform '#{platform_key}' in package_hash")
50
- end
51
- end
52
- end
53
- return true
54
- end
55
-
56
- end
57
- end
58
- end
@@ -1,68 +0,0 @@
1
- require "helpers/test_helper"
2
-
3
- test_name "dsl::helpers::host_helpers #create_tmpdir_on" do
4
-
5
- # NOTE: there does not seem to be a reliable way to confine to cygwin hosts.
6
- confine_block :to, :platform => /windows/ do
7
-
8
- step "#create_tmpdir_on CURRENTLY fails when attempting to chown the created tempdir to the host user + group, on windows platforms" do
9
- # NOTE: would have expected this to work.
10
- # TODO: fix via https://tickets.puppetlabs.com/browse/BKR-496
11
-
12
- assert_raises Beaker::Host::CommandFailure do
13
- tmpdir = create_tmpdir_on default
14
- end
15
- end
16
- end
17
-
18
- confine_block :to, :platform => /osx/ do
19
-
20
- step "#create_tmpdir_on CURRENTLY fails when attempting to call getent to check the creating user" do
21
- # NOTE: would have expected this to work.
22
- # TODO: fix via https://tickets.puppetlabs.com/browse/BKR-496
23
-
24
- assert_raises Beaker::Host::CommandFailure do
25
- tmpdir = create_tmpdir_on default
26
- end
27
- end
28
- end
29
-
30
- confine_block :except, :platform => /windows|osx/ do
31
-
32
- step "#create_tmpdir_on chowns the created tempdir to the host user + group" do
33
- tmpdir = create_tmpdir_on default
34
- listing = on(default, "ls -al #{tmpdir}").stdout
35
- tmpdir_ls = listing.split("\n").grep %r{\s+\./?\s*$}
36
- assert_equal 1, tmpdir_ls.size
37
- perms, inodes, owner, group, *rest = tmpdir_ls.first.split(/\s+/)
38
- assert_equal default['user'], owner
39
- assert_equal default['user'], group
40
- end
41
-
42
- step "#create_tmpdir_on returns a temporary directory on the remote system" do
43
- tmpdir = create_tmpdir_on default
44
- assert_match %r{/}, tmpdir
45
- assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
46
- end
47
-
48
- step "#create_tmpdir_on uses the specified path prefix when provided" do
49
- tmpdir = create_tmpdir_on(default, "mypathprefix")
50
- assert_match %r{/mypathprefix}, tmpdir
51
- assert_equal 0, on(default, "touch #{tmpdir}/testfile").exit_code
52
- end
53
-
54
- step "#create_tmpdir_on fails if a non-existent user is specified" do
55
- assert_raises Beaker::Host::CommandFailure do
56
- tmpdir = create_tmpdir_on default, '', "fakeuser"
57
- end
58
- end
59
-
60
- step "#create_tmpdir_on operates on all hosts if given a hosts array" do
61
- tmpdirs = create_tmpdir_on hosts
62
- hosts.zip(tmpdirs).each do |(host, tmpdir)|
63
- assert_match %r{/}, tmpdir
64
- assert_equal 0, on(host, "touch #{tmpdir}/testfile").exit_code
65
- end
66
- end
67
- end
68
- end