puppet-retrospec 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/Gemfile +4 -4
  4. data/README.md +63 -81
  5. data/VERSION +1 -1
  6. data/bin/retrospec +8 -4
  7. data/lib/retrospec.rb +40 -9
  8. data/lib/retrospec/helpers.rb +36 -2
  9. data/lib/retrospec/puppet_module.rb +3 -1
  10. data/lib/retrospec/templates/clone-hook +39 -0
  11. data/lib/retrospec/version.rb +1 -1
  12. data/puppet-retrospec.gemspec +3 -44
  13. data/spec/unit/puppet-retrospec_spec.rb +4 -65
  14. metadata +3 -100
  15. data/lib/retrospec/templates/acceptance_spec_test.erb +0 -24
  16. data/lib/retrospec/templates/module_files/.fixtures.yml +0 -8
  17. data/lib/retrospec/templates/module_files/.gitignore.erb +0 -8
  18. data/lib/retrospec/templates/module_files/.travis.yml +0 -14
  19. data/lib/retrospec/templates/module_files/Gemfile +0 -27
  20. data/lib/retrospec/templates/module_files/README.markdown +0 -75
  21. data/lib/retrospec/templates/module_files/Rakefile +0 -72
  22. data/lib/retrospec/templates/module_files/Vagrantfile +0 -95
  23. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/centos-59-x64.yml +0 -10
  24. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/centos-64-x64-pe.yml +0 -12
  25. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/centos-64-x64.yml +0 -11
  26. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/centos-66-x64.yml +0 -11
  27. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/debian-607-x64.yml +0 -11
  28. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/debian-70rc1-x64.yml +0 -11
  29. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/debian-73-i386.yml +0 -11
  30. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/debian-73-x64.yml +0 -11
  31. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/default.yml +0 -11
  32. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/fedora-18-x64.yml +0 -11
  33. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/sles-11sp1-x64.yml +0 -11
  34. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +0 -10
  35. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +0 -10
  36. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/ubuntu-server-1310-x64.yml +0 -11
  37. data/lib/retrospec/templates/module_files/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +0 -11
  38. data/lib/retrospec/templates/module_files/spec/shared_contexts.rb +0 -45
  39. data/lib/retrospec/templates/module_files/spec/spec_helper.rb +0 -11
  40. data/lib/retrospec/templates/module_files/spec/spec_helper_acceptance.rb +0 -33
  41. data/lib/retrospec/templates/resource_spec_file.erb +0 -45
  42. data/vendor/gems/puppet-3.7.3/COMMITTERS.md +0 -244
  43. data/vendor/gems/puppet-3.7.3/CONTRIBUTING.md +0 -91
  44. data/vendor/gems/puppet-3.7.3/README.md +0 -76
@@ -1,14 +0,0 @@
1
- branches:
2
- script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
3
- bundler_args: --without development
4
-
5
- rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.5
9
- - 2.2.0
10
- env:
11
- matrix:
12
- - PUPPET_GEM_VERSION="~> 3.2"
13
- - PUPPET_GEM_VERSION="~> 3.7"
14
-
@@ -1,27 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- group :test do
4
- gem "rake"
5
- gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.3'
6
- gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git'
7
- gem "puppetlabs_spec_helper"
8
- gem 'rspec-puppet-utils', :git => 'https://github.com/Accuity/rspec-puppet-utils.git'
9
- gem 'hiera-puppet-helper', :git => 'https://github.com/bobtfish/hiera-puppet-helper.git'
10
- gem "metadata-json-lint"
11
- gem 'puppet-syntax'
12
- gem 'puppet-lint'
13
- end
14
-
15
- group :integration do
16
- gem "beaker", :git => 'https://github.com/puppetlabs/beaker.git'
17
- gem "beaker-rspec", :git => 'https://github.com/puppetlabs/beaker-rspec.git'
18
- gem "vagrant-wrapper"
19
- gem 'serverspec'
20
- end
21
-
22
- group :development do
23
- gem "travis"
24
- gem "travis-lint"
25
- gem "puppet-blacksmith"
26
- gem "guard-rake"
27
- end
@@ -1,75 +0,0 @@
1
- # profiles
2
-
3
- ## Module development setup
4
-
5
- Install all the require gems to run test code
6
- ```shell
7
- bundle install (only need to do once)
8
-
9
- ```
10
- ## Running Tests
11
-
12
- ### Unit tests
13
- This type of testing is fast and should be the first thing you do before comming your code. Mistakes can be found
14
- in a matter of seconds vs minutes/hours. You can test your logic in a unit test. The downside is you need to learn
15
- how to write unit tests which can take some initial time getting used to.
16
-
17
- ```shell
18
- bundle exec rake spec
19
-
20
- ```
21
-
22
- ### Integration Testing
23
- This type of testing is somewhat manual and requires the use of vagrant and a test vm that is controlled by vagrant.
24
- You can find the list of available test vms by running `vagrant status` in the root of the module directory. There is
25
- at lot of magic happening in the vagrantfile that makes this easy. Windows support with this module has not been added yet.
26
-
27
- ```shell
28
-
29
- $ vagrant status
30
- Current machine states:
31
-
32
- win2012r2 not created (vmware_fusion)
33
- win2008r2 not created (vmware_fusion)
34
- centos6 running (vmware_fusion)
35
- ```
36
-
37
- To run a test first you need to define the test code located in module_root/tests directory. This code is nothing more
38
- than a bunch of puppet code that uses your manifest code. You will be using puppet apply to run this code on the vm.
39
- Have a look inside the tests directory for examples.
40
-
41
- Example test file
42
- ```
43
- include profiles::default_linux
44
- file{'/tmp/test.txt':
45
- ensure => file,
46
- content => 'Hello World'
47
- }
48
- ```
49
-
50
- There are a few ways to run the test code against a test vm, both of which have the same outcome.
51
-
52
- ```shell
53
- bundle exec rake spec_prep
54
- VAGRANT_MANIFEST=linux.pp vagrant provision centos6
55
- ```
56
-
57
- or use the rake command which bundles the two commands together
58
-
59
- ```shell
60
- bundle exec rake "vagrant_up[linux.pp,centos6]"
61
- ```
62
-
63
- ### Acceptance Tests
64
- Acceptance testing is sorta like combining unit testing and integration testing where it tests the code on real systems
65
- automatically across a wide range of operating systems. This is an advanced topic, so yu will want to master unit and
66
- integration testing first before writing acceptance tests.
67
-
68
- ```shell
69
- bundle exec rake beaker
70
-
71
- ```
72
-
73
-
74
- ## CI config doc
75
- https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md
@@ -1,72 +0,0 @@
1
- require 'puppetlabs_spec_helper/rake_tasks'
2
- require 'puppet-lint/tasks/puppet-lint'
3
- require 'puppet-syntax/tasks/puppet-syntax'
4
-
5
- # These two gems aren't always present, for instance
6
- # on Travis with --without development
7
- begin
8
- require 'puppet_blacksmith/rake_tasks'
9
- Blacksmith::RakeTask.new do |t|
10
- t.tag_pattern = "v%s" # Use a custom pattern with git tag. %s is replaced with the version number.
11
- end
12
- rescue LoadError
13
- end
14
-
15
- PuppetLint.configuration.relative = true
16
- PuppetLint.configuration.send("disable_80chars")
17
- PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
18
- PuppetLint.configuration.fail_on_warnings = true
19
-
20
- # Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
21
- # http://puppet-lint.com/checks/class_parameter_defaults/
22
- PuppetLint.configuration.send('disable_class_parameter_defaults')
23
- # http://puppet-lint.com/checks/class_inherits_from_params_class/
24
- PuppetLint.configuration.send('disable_class_inherits_from_params_class')
25
-
26
- exclude_paths = [
27
- "pkg/**/*",
28
- "vendor/**/*",
29
- "spec/**/*",
30
- ]
31
- PuppetLint.configuration.ignore_paths = exclude_paths
32
- PuppetSyntax.exclude_paths = exclude_paths
33
-
34
- task :metadata do
35
- sh "metadata-json-lint metadata.json"
36
- end
37
-
38
- desc "Run syntax, lint, and spec tests."
39
- task :test => [
40
- :syntax,
41
- :lint,
42
- :spec,
43
- :metadata,
44
- ]
45
- def io_popen(command)
46
- IO.popen(command) do |io|
47
- io.each do |line|
48
- print line
49
- yield line if block_given?
50
- end
51
- end
52
- end
53
-
54
- desc 'Vagrant VM power up and provision'
55
- task :vagrant_up, [:manifest, :hostname] do |t, args|
56
- args.with_defaults(:manifest => 'init.pp', :hostname => '')
57
- Rake::Task['spec_prep'].execute
58
- ENV['VAGRANT_MANIFEST'] = args[:manifest]
59
- provision = false
60
- io_popen("vagrant up #{args[:hostname]}") do |line|
61
- provision = true if line =~ /is already running./
62
- end
63
- io_popen("vagrant provision #{args[:hostname]}") if provision
64
- end
65
-
66
- # Cleanup vagrant environment
67
- desc 'Vagrant VM shutdown and fixtures cleanup'
68
- task :vagrant_destroy do
69
- Rake::Task['spec_prep'].execute
70
- `vagrant destroy -f`
71
- Rake::Task['spec_clean'].execute
72
- end
@@ -1,95 +0,0 @@
1
- def vm(opt)
2
- module_name = opt.fetch(:module).to_s || raise(ArgumentError, 'Must provide puppet module name')
3
- hostname = opt.fetch(:hostname, module_name).to_s
4
- memory = opt.fetch(:memory, 512)
5
- cpu = opt.fetch(:cpu, 1)
6
- box = opt.fetch(:box).to_s || raise(ArgumentError, 'Must provide box type.')
7
- url = opt.fetch(:url, '').to_s
8
- os_type = opt[:os_type] || opt[:type] || :linux
9
- gui = opt.fetch(:gui, false)
10
- ports = Array(opt.fetch(:port, []))
11
- iso = opt.fetch(:iso, nil)
12
- proj_root = File.expand_path(File.join(File.dirname(__FILE__)))
13
- fixture_modules = File.join(proj_root, 'spec', 'fixtures', 'modules')
14
-
15
- Vagrant.configure('2') do |conf|
16
-
17
- # forward all the ports
18
- ports.each do |p|
19
- conf.vm.network(:forwarded_port, guest: p, host: p, auto_correct: true)
20
- end
21
-
22
- if os_type == :windows
23
- conf.ssh.username = 'vagrant'
24
- conf.winrm.username = 'vagrant'
25
- conf.winrm.password = 'vagrant'
26
- end
27
-
28
- conf.vm.define hostname.to_sym do |mod|
29
- mod.vm.box = box
30
- mod.vm.box_url = url
31
-
32
- if os_type == :windows
33
- mod.vm.guest = :windows
34
- mod.vm.communicator = 'winrm'
35
- mod.vm.synced_folder './' , "/ProgramData/PuppetLabs/puppet/etc/modules/#{module_name}"
36
- mod.vm.synced_folder 'spec/fixtures/modules' , '/temp/modules'
37
- else
38
- mod.vm.synced_folder './', "/etc/puppet/modules/#{module_name}"
39
- mod.vm.synced_folder 'spec/fixtures/modules', '/tmp/puppet/modules'
40
- end
41
-
42
- mod.vm.hostname = hostname
43
-
44
- mod.vm.provider :vmware_fusion do |f|
45
- f.gui = gui
46
- f.vmx['displayName'] = hostname
47
- f.vmx['memsize'] = memory
48
- f.vmx['numvcpus'] = cpu
49
- if iso
50
- f.vmx['ide1:0.devicetype'] = "cdrom-image"
51
- f.vmx['ide1:0.filename'] = iso
52
- end
53
- end
54
-
55
- mod.vm.provider :vmware_workstation do |f|
56
- f.gui = gui
57
- f.vmx['displayName'] = hostname
58
- f.vmx['memsize'] = memory
59
- f.vmx['numvcpus'] = cpu
60
- if iso
61
- f.vmx['ide1:0.devicetype'] = "cdrom-image"
62
- f.vmx['ide1:0.filename'] = iso
63
- end
64
- end
65
-
66
- mod.vm.provider :virtualbox do |v|
67
- v.gui = gui
68
- v.name = hostname
69
- v.memory = memory
70
- v.cpus = cpu
71
- end
72
-
73
- if os_type == :windows
74
- manifest = ENV['VAGRANT_MANIFEST'] || 'init.pp'
75
- mod.vm.provision :shell, :inline => "@powershell -NoProfile -ExecutionPolicy Bypass -Command \"iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))\" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
76
- mod.vm.provision :shell, :inline => "choco install puppet"
77
- mod.vm.provision :shell, :inline => "puppet apply --modulepath 'C:/ProgramData/PuppetLabs/puppet/etc/modules;C:/temp/modules' --verbose C:/ProgramData/PuppetLabs/puppet/etc/modules/#{module_name}/tests/#{manifest}"
78
- else
79
- mod.vm.provision :puppet do |p|
80
- p.manifests_path = 'tests'
81
- p.hiera_config_path = File.join(fixture_modules, 'hieradata', 'hiera.yaml')
82
- p.manifest_file = ENV['VAGRANT_MANIFEST'] || 'init.pp'
83
- #p.module_path = fixture_modules
84
- # because of how symlinks are handled via the spec_helper we are forced to mount the modules is different locations
85
- # otherwise we could just use the above option
86
- p.options = '--modulepath="/etc/puppet/modules:/tmp/puppet/modules"'
87
- end
88
- end
89
- end
90
- end
91
- end
92
- module_name = File.basename(File.expand_path(File.join(File.dirname(__FILE__))))
93
- vm :hostname => 'win2012r2', :module => module_name, :box => 'opentable/win-2012r2-standard-amd64-nocm', :url => 'opentable/win-2012r2-standard-amd64-nocm', :cpu => 1, :memory => 4096, :gui => true
94
- vm :hostname => 'win2008r2', :module => module_name, :box => 'opentable/win-2008r2-standard-amd64-nocm', :url => 'opentable/win-2008r2-standard-amd64-nocm', :cpu => 1, :memory => 4096, :gui => true
95
- vm :hostname => 'centos6', :module => module_name, :box => 'puppetlabs/centos-6.6-64-puppet', :url => 'puppetlabs/centos-6.6-64-puppet', :cpu => 1, :memory => 2048, :gui => false
@@ -1,10 +0,0 @@
1
- HOSTS:
2
- centos-59-x64:
3
- roles:
4
- - master
5
- platform: el-5-x86_64
6
- box : centos-59-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- type: git
@@ -1,12 +0,0 @@
1
- HOSTS:
2
- centos-64-x64:
3
- roles:
4
- - master
5
- - database
6
- - dashboard
7
- platform: el-6-x86_64
8
- box : centos-64-x64-vbox4210-nocm
9
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
10
- hypervisor : vagrant
11
- CONFIG:
12
- type: pe
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- centos-64-x64:
3
- roles:
4
- - master
5
- platform: el-6-x86_64
6
- box : centos-64-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- centos-66-x64:
3
- roles:
4
- - master
5
- platform: el-6-x86_64
6
- box: puppetlabs/centos-6.6-64-nocm
7
- box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
8
- hypervisor: vagrant
9
- CONFIG:
10
- log_level: verbose
11
- type: foss
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- debian-607-x64:
3
- roles:
4
- - master
5
- platform: debian-6-amd64
6
- box : debian-607-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- debian-70rc1-x64:
3
- roles:
4
- - master
5
- platform: debian-7-amd64
6
- box : debian-70rc1-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- debian-73-i386:
3
- roles:
4
- - master
5
- platform: debian-7-i386
6
- box : debian-73-i386-virtualbox-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-i386-virtualbox-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- debian-73-x64:
3
- roles:
4
- - master
5
- platform: debian-7-amd64
6
- box : debian-73-x64-virtualbox-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- centos-66-x64:
3
- roles:
4
- - master
5
- platform: el-6-x86_64
6
- box: puppetlabs/centos-6.6-64-nocm
7
- box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
8
- hypervisor: vagrant
9
- CONFIG:
10
- log_level: verbose
11
- type: foss
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- fedora-18-x64:
3
- roles:
4
- - master
5
- platform: fedora-18-x86_64
6
- box : fedora-18-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,11 +0,0 @@
1
- HOSTS:
2
- sles-11sp1-x64:
3
- roles:
4
- - master
5
- platform: sles-11-x86_64
6
- box : sles-11sp1-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- log_level: debug
11
- type: git
@@ -1,10 +0,0 @@
1
- HOSTS:
2
- ubuntu-server-10044-x64:
3
- roles:
4
- - master
5
- platform: ubuntu-10.04-amd64
6
- box : ubuntu-server-10044-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- type: foss
@@ -1,10 +0,0 @@
1
- HOSTS:
2
- ubuntu-server-12042-x64:
3
- roles:
4
- - master
5
- platform: ubuntu-12.04-amd64
6
- box : ubuntu-server-12042-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- type: foss