puppet-retrospec 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/CHANGELOG.md +11 -0
- data/DEVELOPMENT.md +3 -0
- data/Gemfile +10 -9
- data/Gemfile.lock +2 -0
- data/README.md +211 -273
- data/Rakefile +8 -8
- data/VERSION +1 -1
- data/lib/retrospec-puppet.rb +3 -3
- data/lib/retrospec/plugins/v1/plugin/conditional.rb +5 -6
- data/lib/retrospec/plugins/v1/plugin/exceptions.rb +17 -0
- data/lib/retrospec/plugins/v1/plugin/generators.rb +7 -0
- data/lib/retrospec/plugins/v1/plugin/generators/fact_generator.rb +18 -10
- data/lib/retrospec/plugins/v1/plugin/generators/function_generator.rb +187 -0
- data/lib/retrospec/plugins/v1/plugin/generators/module_generator.rb +25 -26
- data/lib/retrospec/plugins/v1/plugin/generators/{facter.rb → parsers/facter.rb} +28 -35
- data/lib/retrospec/plugins/v1/plugin/generators/parsers/function.rb +91 -0
- data/lib/retrospec/plugins/v1/plugin/generators/parsers/type.rb +79 -0
- data/lib/retrospec/plugins/v1/plugin/generators/provider_generator.rb +107 -0
- data/lib/retrospec/plugins/v1/plugin/generators/schema_generator.rb +221 -0
- data/lib/retrospec/plugins/v1/plugin/generators/type_generator.rb +118 -0
- data/lib/retrospec/plugins/v1/plugin/helpers.rb +3 -7
- data/lib/retrospec/plugins/v1/plugin/puppet.rb +141 -60
- data/lib/retrospec/plugins/v1/plugin/puppet_module.rb +29 -26
- data/lib/retrospec/plugins/v1/plugin/resource.rb +6 -7
- data/lib/retrospec/plugins/v1/plugin/spec_object.rb +5 -8
- data/lib/retrospec/plugins/v1/plugin/template_helpers.rb +9 -10
- data/lib/retrospec/plugins/v1/plugin/templates/clone-hook +15 -8
- data/lib/retrospec/plugins/v1/plugin/type_code.rb +4 -4
- data/lib/retrospec/plugins/v1/plugin/variable_store.rb +26 -30
- data/lib/retrospec/plugins/v1/plugin/version.rb +1 -1
- data/puppet-retrospec.gemspec +43 -4
- data/spec/fixtures/facts/oracle_controls.rb +38 -0
- data/spec/fixtures/fixture_modules/required_parameters/manifests/init.pp +8 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/facter/fix_installed.rb +11 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/awesome_parser.rb +13 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/functions/reduce.rb +31 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/bad_sha1.rb +6 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/defined.rb +94 -0
- data/spec/fixtures/fixture_modules/sample_module/lib/puppet/parser/functions/sha1.rb +6 -0
- data/spec/fixtures/fixture_modules/sample_module/spec/unit/facter/fix_installed_spec.rb +21 -0
- data/spec/fixtures/modules/tomcat/files/.gitkeep +0 -0
- data/spec/fixtures/modules/tomcat/templates/.gitkeep +0 -0
- data/spec/fixtures/modules/tomcat/tests/.gitkeep +0 -0
- data/spec/fixtures/providers/bmc/ipmitool.rb +188 -0
- data/spec/fixtures/providers/bmcuser/ipmitool.rb +140 -0
- data/spec/fixtures/types/bmc.rb +102 -0
- data/spec/fixtures/types/bmcuser.rb +46 -0
- data/spec/fixtures/types/db_opatch.rb +93 -0
- data/spec/integration/retrospec_spec.rb +1 -3
- data/spec/spec_helper.rb +33 -6
- data/spec/unit/conditional_spec.rb +12 -15
- data/spec/unit/generators/fact_generater_spec.rb +49 -17
- data/spec/unit/generators/function_generator_spec.rb +301 -0
- data/spec/unit/generators/function_spec.rb +67 -0
- data/spec/unit/generators/parsers/fact_spec.rb +62 -0
- data/spec/unit/generators/parsers/provider_spec.rb +44 -0
- data/spec/unit/generators/parsers/type_spec.rb +93 -0
- data/spec/unit/generators/provider_generator_spec.rb +120 -0
- data/spec/unit/generators/schema_generator_spec.rb +122 -0
- data/spec/unit/generators/type_generator_spec.rb +173 -0
- data/spec/unit/module_spec.rb +7 -10
- data/spec/unit/plugin_spec.rb +213 -15
- data/spec/unit/puppet-retrospec_spec.rb +81 -100
- data/spec/unit/resource_spec.rb +16 -17
- data/spec/unit/spec_object_spec.rb +46 -0
- data/spec/unit/type_code_spec.rb +9 -11
- data/spec/unit/variable_store_spec.rb +41 -43
- metadata +54 -4
- data/spec/unit/generators/fact_spec.rb +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ef0263824df8bfe64011c9a30ad1a8ef8fbf3de
|
4
|
+
data.tar.gz: 9ad09244dae7ae1ec2db249182d9986fef0ad812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f5380eb28ffa6cc128c6c53c96ba8d77d0c6ff212d2bd30752fc5476539bd82efccc28efc6ed88632c352772a7f22675f186028bdbec9a7a9422735a5e7a3ef
|
7
|
+
data.tar.gz: 590a1a3f3eafc2fc621e8af7b335d47bf4eaec2e9b22491c3b17e8c9a5d33f03a700cb0bbbf257c610755afd25d6c94fcc2d6574f4e4aadc159422137fa432e2
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- vendor/**/*
|
4
|
+
- pkg/**/*
|
5
|
+
- spec/fixtures/**/*
|
6
|
+
|
7
|
+
# Configuration parameters: AllowURI, URISchemes.
|
8
|
+
Metrics/LineLength:
|
9
|
+
Max: 128
|
10
|
+
|
11
|
+
# dealbreaker:
|
12
|
+
Style/TrailingComma:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
# we still support ruby 1.8
|
16
|
+
Style/HashSyntax:
|
17
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 0.12.0
|
2
|
+
* fix an annoying issue when creating new modules and current directory
|
3
|
+
* gh-38 - added ability to create new types and type unit tests
|
4
|
+
* gh-39 - add functionality to create new providers
|
5
|
+
* gh-40 - add ability to generate functions
|
6
|
+
* gh-43 - add ability to create kwalify schema files
|
7
|
+
* gh-42 - continue with creating files when retrospec parser fails on invalid code
|
8
|
+
## 0.11.0
|
9
|
+
* gh-31 - add ability to generate new fact and spec tests
|
10
|
+
* add awesome_print gem
|
11
|
+
* gh-37 - move new module functionality to its own generator class
|
1
12
|
## 0.10.0
|
2
13
|
* refactor cli options to use retrospec 0.4.0 specifications
|
3
14
|
* gh-32 - add ability to create new module
|
data/DEVELOPMENT.md
ADDED
data/Gemfile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
gem 'trollop'
|
4
|
-
gem 'retrospec',
|
4
|
+
gem 'retrospec', '~> 0.4'
|
5
5
|
gem 'awesome_print'
|
6
|
+
gem 'facets'
|
6
7
|
# Include everything needed to run rake, tests, features, etc.
|
7
8
|
group :development do
|
8
|
-
gem
|
9
|
-
gem 'puppet', '3.7.3',
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
9
|
+
gem 'rspec', '~> 3.2'
|
10
|
+
gem 'puppet', '3.7.3', :path => 'vendor/gems/puppet-3.7.3'
|
11
|
+
gem 'yard', '~> 0.7'
|
12
|
+
gem 'rdoc', '~> 3.12'
|
13
|
+
gem 'bundler', '~> 1.0'
|
14
|
+
gem 'jeweler'
|
14
15
|
gem 'pry'
|
15
|
-
gem
|
16
|
+
gem 'fakefs', :require => 'fakefs/safe'
|
16
17
|
end
|
data/Gemfile.lock
CHANGED
@@ -17,6 +17,7 @@ GEM
|
|
17
17
|
descendants_tracker (0.0.4)
|
18
18
|
thread_safe (~> 0.3, >= 0.3.1)
|
19
19
|
diff-lcs (1.2.5)
|
20
|
+
facets (3.0.0)
|
20
21
|
facter (2.4.4)
|
21
22
|
CFPropertyList (~> 2.2.6)
|
22
23
|
fakefs (0.6.7)
|
@@ -94,6 +95,7 @@ PLATFORMS
|
|
94
95
|
DEPENDENCIES
|
95
96
|
awesome_print
|
96
97
|
bundler (~> 1.0)
|
98
|
+
facets
|
97
99
|
fakefs
|
98
100
|
jeweler
|
99
101
|
pry
|
data/README.md
CHANGED
@@ -1,95 +1,104 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/puppet-retrospec.svg)](http://badge.fury.io/rb/puppet-retrospec)
|
2
|
-
|
3
1
|
Puppet-Retrospec
|
4
2
|
================
|
3
|
+
A retrospec plugin for puppet that generates puppet rspec test code based on the current code inside your module.
|
4
|
+
|
5
|
+
Proper testing is hard especially when you are new to ruby, rspec or even puppet.
|
6
|
+
|
7
|
+
Retrospec makes it dead simple to get started with advanced puppet module development. Retrospec will scan you puppet module files and actually write some very basic rspec-puppet test code. Thus this gem will retrofit your existing puppet module with everything needed to get going with puppet unit testing. Additionally, retrospec will outfit your module with any file you can think of. Say goodbye to repetitive module setup.
|
5
8
|
|
6
|
-
|
7
|
-
Aims to reduce most of the boilerplate coding with default test patterns and module setup.
|
9
|
+
Not only will retrospec generate tests for you, it will also assist in creating many of the advanced puppet module files like custom facts, functions, types, providers and schemas, as well as their associated test files. It will even create the module from scratch if so desired.
|
8
10
|
|
9
|
-
|
10
|
-
When you run retrospec, retrospec will scan you puppet manifests and actually write some very basic rspec-puppet test code.
|
11
|
-
Thus this gem will retrofit your existing puppet module with everything needed to get going with puppet unit testing.
|
12
|
-
Additionally, retrospec will outfit your module with any file you can think of. Say goodbye to repetitive module setup.
|
11
|
+
The project was named retrospec because there are many times when you need to retrofit your module with various things.
|
13
12
|
|
14
|
-
|
13
|
+
If you like this project, star it and tell people!
|
15
14
|
|
16
15
|
Table of Contents
|
17
16
|
=================
|
18
17
|
|
19
18
|
* [Build Status](#build-status)
|
20
19
|
* [News](#news)
|
21
|
-
* [Dependency](#dependency)
|
22
20
|
* [Install](#install)
|
23
|
-
* [How to use](#
|
24
|
-
|
21
|
+
* [How to use](#usage)
|
22
|
+
* [Module Path](#module-path)
|
23
|
+
* [Command Line Help](#command-line-help)
|
24
|
+
* [Design Goals](#design-goals)
|
25
|
+
* [Using the Generators](#using-the-generators)
|
26
|
+
* [Auto spec file creation](#auto-spec-file-creation)
|
27
|
+
* [Creating a new puppet module](#creating-a-new-puppet-module)
|
28
|
+
* [Creating a new fact](#creating-a-new-fact)
|
29
|
+
* [Creating a new provider](#creating-a-new-provider)
|
30
|
+
* [Creating a new function](#creating-a-new-function)
|
31
|
+
* [Creating a new type](#creating-a-new-type)
|
32
|
+
* [Creating a schema file](#creating-a-new-module-schema-file)
|
33
|
+
* [Dependency](#dependency)
|
34
|
+
* [Enable Future Parser](#enabling-the-future-parser)
|
35
|
+
* [Configuration](#configuration)
|
25
36
|
* [Example](#example)
|
26
37
|
* [About the test suite](#about-the-test-suite)
|
27
38
|
* [How Does it do this](#how-does-it-do-this)
|
28
|
-
* [Overriding the templates](#overriding-the-templates)
|
29
|
-
* [Adding New Templates](#adding-new-templates)
|
30
39
|
* [Beaker Testing](#beaker-testing)
|
31
40
|
* [Troubleshooting](#troubleshooting)
|
32
41
|
* [Running Tests](#running-tests)
|
33
42
|
* [Understanding Variable Resolution](#understanding-variable-resolution)
|
34
43
|
* [Todo](#todo)
|
35
44
|
* [Future Parser Support](#future-parser-support)
|
36
|
-
* [Support](#support)
|
45
|
+
* [Paid Support](#paid-support)
|
37
46
|
|
38
47
|
TOC Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
39
48
|
|
40
|
-
Build Status
|
41
|
-
============
|
49
|
+
## Build Status
|
42
50
|
[![Build Status](https://travis-ci.org/logicminds/puppet-retrospec.png)](https://travis-ci.org/logicminds/puppet-retrospec)
|
43
51
|
[![Gem Version](https://badge.fury.io/rb/puppet-retrospec.svg)](http://badge.fury.io/rb/puppet-retrospec)
|
44
52
|
|
45
53
|
## News
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
Because I found this gem to be so useful I figured I could make it automate other types of projects and generalized its
|
50
|
-
use case. So now any project you create can have its development workflow automated with retrospec.
|
51
|
-
|
52
|
-
More info: https://github.com/nwops/retrospec.git
|
54
|
+
### 1-18-16
|
55
|
+
A slew of new features has been added with the 0.12 update. If you already use retrospec to retrofit your modules, now you can use retrospec to generate some of the more advanced puppet module customizations such as:
|
53
56
|
|
54
|
-
|
55
|
-
|
57
|
+
- custom facts
|
58
|
+
- providers
|
59
|
+
- custom types
|
60
|
+
- functions (v3 and v4)
|
61
|
+
- parameter schemas
|
56
62
|
|
57
|
-
|
58
|
-
|
59
|
-
Fetching: retrospec-0.3.0.gem (100%)
|
60
|
-
retrospec's executable "retrospec" conflicts with puppet-retrospec
|
61
|
-
Overwrite the executable? [yN] y
|
62
|
-
Successfully installed retrospec-0.3.0
|
63
|
-
Fetching: puppet-retrospec-0.9.0.gem (100%)
|
64
|
-
Successfully installed puppet-retrospec-0.9.0
|
65
|
-
Parsing documentation for retrospec-0.3.0
|
66
|
-
Installing ri documentation for retrospec-0.3.0
|
67
|
-
Parsing documentation for puppet-retrospec-0.9.0
|
68
|
-
Installing ri documentation for puppet-retrospec-0.9.0
|
69
|
-
2 gems installed
|
63
|
+
This has been a feature in the making since Puppetconf 2015. I would have finished this sooner but was sucked in
|
64
|
+
binge watching a bunch of Netflix shows. Check out `retrospec puppet -h` for a list of all new subcommands.
|
70
65
|
|
71
|
-
```
|
72
66
|
|
73
|
-
## Dependency
|
74
|
-
Retrospec relies heavily on the puppet 3.7.x codebase. Because of this hard dependency the puppet gem is vendored into
|
75
|
-
the library so there should not be conflicts with your existing puppet gem.
|
76
|
-
|
77
67
|
## Install
|
78
68
|
`gem install puppet-retrospec`
|
79
69
|
|
80
70
|
This will also install the retrospec framework that is required to use the plugin.
|
81
71
|
|
82
|
-
##
|
72
|
+
## Usage
|
73
|
+
The easiest way to get started using retrospec-puppet is to run `retrospec puppet`
|
74
|
+
from within your module directory. Retrospec uses the current directory if no options
|
75
|
+
are specified. Expect to run `retrospec puppet` multiple times throughout the day.
|
76
|
+
Retrospec will never overwrite a file, so if something already exists retrospec will
|
77
|
+
skip the file. Many times you will find yourself deleting existing files and allowing retrospec to recreate them based on updated templates.
|
78
|
+
|
79
|
+
### Module Path
|
80
|
+
By default the module path is dynamically set based on the current directory.
|
81
|
+
If you need to point to a directory outside the current directory you can use the `--module_path` option. This option is built into the retrospec framework
|
82
|
+
so be sure to use `retrospec -m path_to_module`.
|
83
83
|
|
84
|
-
|
84
|
+
### Command Line Help
|
85
|
+
There is a `-h` at every level of commands and subcommands.
|
86
|
+
|
87
|
+
- `retrospec -h`
|
88
|
+
- `retrospec puppet -h`
|
89
|
+
- `retrospec puppet <sub_command> -h`
|
85
90
|
|
86
|
-
If you need to point to a directory outside the current directory you can use the `--module_path` option.
|
87
91
|
```
|
88
92
|
[puppet@puppetdev ~]$ retrospec -m /tmp/test3323 puppet -h
|
89
93
|
Generates puppet rspec test code based on the classes and defines inside the manifests directory.
|
90
94
|
|
91
95
|
Subcommands:
|
92
96
|
new_module
|
97
|
+
new_fact
|
98
|
+
new_type
|
99
|
+
new_provider
|
100
|
+
new_function
|
101
|
+
|
93
102
|
-t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates)
|
94
103
|
(default: /Users/cosman/.retrospec/repos/retrospec-puppet-templates)
|
95
104
|
-s, --scm-url=<s> SCM url for retrospec templates (default:
|
@@ -103,76 +112,142 @@ new_module
|
|
103
112
|
-h, --help Show this message -h, --help Show this message
|
104
113
|
```
|
105
114
|
|
115
|
+
## Design Goals
|
116
|
+
One of the design goals of this plugin is to try to introspect as much information as possible so we don't need input from the user. If you are not sure what default values are used, use the `-h` option and the defaults will be revealed. Most of the defaults are dynamic.
|
106
117
|
|
107
|
-
|
108
|
-
|
109
|
-
|
118
|
+
Another design goal is to allow the user to configure every option, so that passing
|
119
|
+
additional options is not required when configured correctly. Please see the [Configuration Section](#configuration) for setting a config file.
|
120
|
+
|
121
|
+
## Using the Generators
|
122
|
+
At this time the generators are limited to just creating facts, providers, types, functions and schemas. As time goes on I envision more complicated puppet customizations like faces, indirectors, reports, or whatever else the community deems important.
|
110
123
|
|
111
|
-
|
124
|
+
*Note:* the unit tests files created are only meant to get you started. Be aware that these unit test templates are not perfect and will need further refinement. Testing in this area is not well documented so its based of my own experience and imperfect. Please submit a PR if you find ways to improve these [templates](https://github.com/nwops/retrospec-templates).
|
112
125
|
|
113
|
-
|
114
|
-
|
126
|
+
### Auto spec file creation
|
127
|
+
Each generator will also create associated test files by default without having to use the generator command. So if there is a existing module without tests for one of these things, retrospec will create the test files automatically. There is no need to run the generator subcommands to generate spec files for existing puppet module ruby files.
|
115
128
|
|
129
|
+
### Creating a new puppet module
|
130
|
+
You can create a puppet module from scratch using retrospec.
|
131
|
+
This can be compared to using `puppet module generate` with a skeleton. Retrospec
|
132
|
+
differs slightly in that you can specify which skeleton/templates to use at creation time. This is helpful when working with different clients or puppet versions.
|
133
|
+
Unlike `puppet module generate` retrospec does not force you to create a
|
134
|
+
directory with a namespace. This means you do not need to rename anything after creating it. By default retrospec will consult the retrospec config file for default settings which can be overridden on the command line. Having the config in place can save you a few key strokes.
|
116
135
|
|
117
136
|
```
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
+ /tmp/
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
+ /tmp/
|
136
|
-
+ /tmp/
|
137
|
-
+ /tmp/
|
138
|
-
+ /tmp/
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
137
|
+
# use -m to specify the module path
|
138
|
+
retrospec -m /tmp/test_module_123 puppet new_module -n lmc-test123
|
139
|
+
# or without specifying module_path
|
140
|
+
cd /tmp/modules
|
141
|
+
export RETROSPEC_PUPPET_AUTO_GENERATE=true
|
142
|
+
retrospec puppet new_module -n lmc-test124
|
143
|
+
+ /private/tmp/modules/lmc-test124/manifests/
|
144
|
+
+ /private/tmp/modules/lmc-test124/manifests/init.pp
|
145
|
+
+ /private/tmp/modules/lmc-test124/metadata.json
|
146
|
+
```
|
147
|
+
|
148
|
+
### Creating a new fact
|
149
|
+
Creating a new fact is easy with retrospec. Just use the following to
|
150
|
+
create a fact and unit test.
|
151
|
+
```
|
152
|
+
retrospec -m /tmp/test_module_123 puppet new_fact -n datacenter
|
153
|
+
Successfully ran hook: /Users/cosman/github/retrospec-templates/clone-hook
|
154
|
+
+ /private/tmp/modules/test123/lib/facter/
|
155
|
+
+ /private/tmp/modules/test123/lib/facter/datacenter.rb
|
156
|
+
+ /private/tmp/modules/test123/spec/unit/facter/
|
157
|
+
+ /private/tmp/modules/test123/spec/unit/facter/datacenter_spec.rb
|
158
|
+
```
|
159
|
+
|
160
|
+
### Creating a new provider
|
161
|
+
Create a new provider is easy. Just specify the puppet type you want the generator
|
162
|
+
to use and the stub code for a provider and provider test file will be created.
|
163
|
+
|
164
|
+
```
|
165
|
+
cd testabc124
|
166
|
+
retrospec puppet new_provider -t package -n ibm_pkg
|
167
|
+
Successfully ran hook: /Users/user1/retrospec-templates/clone-hook
|
168
|
+
|
169
|
+
+ /tmp/testabc124/lib/puppet/provider/package/
|
170
|
+
+ /tmp/testabc124/lib/puppet/provider/package/ibm_pkg.rb
|
171
|
+
Successfully ran hook: /Users/user1/retrospec-templates/pre-hook
|
172
|
+
```
|
173
|
+
### Creating a new function
|
174
|
+
Creating a new function is just as easy as other generators. Use the new_function
|
175
|
+
sub command and specify the name. Specify `--type v4` if you wish to create
|
176
|
+
a new 'v4' function, otherwise v3 is the default. Since testing functions
|
177
|
+
can be done in both rspec-ruby and rspec-puppet you can specify the test type as
|
178
|
+
well and retrospec will default to `rspec-puppet`.
|
179
|
+
|
180
|
+
```
|
181
|
+
cd testabc124
|
182
|
+
retrospec puppet new_function -n is_url
|
183
|
+
Successfully ran hook: /Users/user1/retrospec-templates/clone-hook
|
184
|
+
+ /private/tmp/testabc124/lib/puppet/parser/functions/
|
185
|
+
+ /private/tmp/testabc124/lib/puppet/parser/functions/is_url.rb
|
186
|
+
```
|
147
187
|
|
188
|
+
### Creating a new type
|
189
|
+
Creating a type is similar to any other generator. You can specify which parameters,
|
190
|
+
properties, and providers to generate. Retrospec will generate a default provider
|
191
|
+
if none are specified.
|
192
|
+
|
193
|
+
```
|
194
|
+
retrospec puppet new_type -n test_type --parameters param1 param2 --properties prop1 prop2 --providers default
|
195
|
+
Successfully ran hook: /Users/user1/retrospec-templates/clone-hook
|
196
|
+
|
197
|
+
+ /private/tmp/testabc124/lib/puppet/type/
|
198
|
+
+ /private/tmp/testabc124/lib/puppet/type/test_type.rb
|
199
|
+
+ /private/tmp/testabc124/lib/puppet/provider/test_type/
|
200
|
+
+ /private/tmp/testabc124/lib/puppet/provider/test_type/default.rb
|
201
|
+
Successfully ran hook: /Users/user1/retrospec-templates/pre-hook
|
148
202
|
```
|
203
|
+
### Creating a new module schema file
|
204
|
+
Schema files are something I came up with recently and something I have found useful for various things. These schema files map all the puppet parameters in the classes and defines you have inside your module. You can use these schema files for validating hiera, generating documentation, or to serve as parameter documentation. At this time the generator map only known datatypes so its up to you to define some of the complex data structures you have for puppet parameters.
|
205
|
+
Maintaining a schema file is optional, but is incredible useful for people using your module and validating hiera data. Schema files are generated by default with every `retrospec puppet` run.
|
149
206
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
207
|
+
```
|
208
|
+
cd testabc124
|
209
|
+
retrospec puppet
|
210
|
+
+ /private/tmp/testabc124/testabc124_schema.yaml
|
211
|
+
```
|
212
|
+
|
213
|
+
## Dependency
|
214
|
+
Retrospec relies heavily on the puppet 3.7.x codebase. Because of this hard dependency the puppet gem is vendored into the library so there should not be conflicts with your existing puppet gem.
|
215
|
+
|
216
|
+
## Enabling the future parser
|
217
|
+
|
218
|
+
`retrospec -m ~/projects/puppet_modules/apache puppet --enable-future-parser`
|
219
|
+
|
220
|
+
Please see #future-parser-support for why this might be required.
|
221
|
+
|
222
|
+
## Configuration
|
223
|
+
Below is a list of options that you can set in the config file. Setting these options will help cut down on passing parameters. (/Users/username/.retrospec/config.yaml) `retrospec -h`
|
224
|
+
|
225
|
+
*Note:* if might be useful to have several config files for different clients or
|
226
|
+
situations where you want to easily swap out templates or options.
|
227
|
+
`retrospec --config-map /Users/user1/.retrospec/client1.yaml`
|
155
228
|
|
156
229
|
```yaml
|
230
|
+
# used by the main puppet plugin and every subcommand
|
157
231
|
plugins::puppet::templates::url: https://github.com/nwops/retrospec-templates
|
158
232
|
plugins::puppet::templates::ref: master
|
159
233
|
plugins::puppet::enable_beaker_tests: true
|
160
234
|
plugins::puppet::enable_future_parser: true
|
161
235
|
plugins::puppet::template_dir: /Users/username/.retrospec/repos/retrospec-puppet-templates
|
236
|
+
# used when creating new modules
|
162
237
|
plugins::puppet::namespace: organization
|
238
|
+
plugins::puppet::default_license: 'Apache-2.0'
|
163
239
|
plugins::puppet::author: your_name
|
240
|
+
# used when creating new functions
|
241
|
+
plugins::puppet::default_function_version: v3
|
242
|
+
plugins::puppet::default_function_test_type: rspec
|
243
|
+
|
244
|
+
|
164
245
|
```
|
165
|
-
Note: your not required to set any of these as they can be specified on the cli and also default to
|
166
|
-
sane values.
|
167
246
|
|
168
|
-
|
169
|
-
======================
|
247
|
+
*Note:* your not required to set any of these as they can be specified on the cli and also default to reasonable values.
|
170
248
|
|
171
|
-
|
172
|
-
that you need for unit testing puppet code. Rspec-puppet best practices says to put definitions in a defines folder
|
173
|
-
and classes in a classes folder since it infers what kind of resource it is based on this convention. Retrospec sets up
|
174
|
-
this scaffolding for you. Don't like the files that came with your module? Simply delete the files and re-generate them
|
175
|
-
with retrospec.
|
249
|
+
## Example
|
250
|
+
Below you can see that it creates files for every resource in the apache module in addition to other files that you need for unit testing puppet code. Rspec-puppet best practices says to put definitions in a defines folder and classes in a classes folder since it infers what kind of resource it is based on this convention. Retrospec sets up this scaffolding for you. Don't like the files that came with your module? Simply delete the files and regenerate them with `puppet retrospec`.
|
176
251
|
|
177
252
|
```shell
|
178
253
|
$ pwd
|
@@ -190,37 +265,19 @@ $ retrospec puppet
|
|
190
265
|
+ /Users/cosman/github/puppetlabs-apache/spec/classes/default_mods_spec.rb
|
191
266
|
+ /Users/cosman/github/puppetlabs-apache/spec/classes/dev_spec.rb
|
192
267
|
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/disk_cache_spec.rb
|
193
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/fcgid_spec.rb
|
194
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/headers_spec.rb
|
195
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/info_spec.rb
|
196
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/itk_spec.rb
|
197
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/ldap_spec.rb
|
198
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/mod/mime_spec.rb
|
199
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/php_spec.rb
|
200
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/proxy_spec.rb
|
201
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/classes/python_spec.rb
|
202
268
|
+ /Users/cosman/github/puppetlabs-apache/spec/classes/service_spec.rb
|
203
269
|
+ /Users/cosman/github/puppetlabs-apache/spec/classes/ssl_spec.rb
|
204
270
|
+ /Users/cosman/github/puppetlabs-apache/spec/defines/
|
205
271
|
+ /Users/cosman/github/puppetlabs-apache/spec/defines/balancer_spec.rb
|
206
272
|
+ /Users/cosman/github/puppetlabs-apache/spec/defines/balancermember_spec.rb
|
207
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/defines/default_mods/
|
208
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/defines/default_mods/load_spec.rb
|
209
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/defines/listen_spec.rb
|
210
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/defines/mod_spec.rb
|
211
|
-
+ /Users/cosman/github/puppetlabs-apache/spec/defines/namevirtualhost_spec.rb
|
212
273
|
+ /Users/cosman/github/puppetlabs-apache/spec/defines/vhost_spec.rb
|
213
|
-
|
274
|
+
|
214
275
|
```
|
215
276
|
|
216
|
-
Looking at the file we can see that it did a lot of work for us. Retrospec generated many tests automatically.
|
217
|
-
|
218
|
-
|
219
|
-
Below is the classes/apache_spec.rb file. Notice that while Retrospec created all these files, you still need to do more work.
|
220
|
-
Retrospec is only here to setup your module for testing, which might save you several hours each time you create a module.
|
221
|
-
Below I'll go through the different parts of automation that you can use in your testing.
|
277
|
+
Looking at the file we can see that it did a lot of work for us. Retrospec generated many tests automatically. However the variable resolution isn't perfect so you will need to manually resolve some variables. This doesn't produce 100% coverage but all you did was press enter to produce all this anyways. Below is the classes/apache_spec.rb file. Notice that while Retrospec created all these files, you still need to do more work.
|
278
|
+
Retrospec is only here to setup your module for testing, which might save you several hours each time you create a module. Below I'll go through the different parts of automation that you can use in your testing.
|
279
|
+
|
222
280
|
|
223
|
-
|
224
281
|
```ruby
|
225
282
|
require 'spec_helper'
|
226
283
|
require 'shared_contexts'
|
@@ -392,16 +449,11 @@ end
|
|
392
449
|
|
393
450
|
```
|
394
451
|
|
395
|
-
About the test suite
|
396
|
-
|
397
|
-
|
398
|
-
resource not in a code block with the exception of conditional code blocks. While this might be all you need, the more
|
399
|
-
complex your code is the less retrospec will generate until further improvements to the generator are made.
|
452
|
+
## About the test suite
|
453
|
+
At this time the test suite that is automatically generated is very basic. Essentially it just creates a test for every resource not in a code block with the exception of conditional code blocks. While this might be all you need, the more complex your code is the less retrospec will generate until further improvements to the generator are made.
|
454
|
+
|
400
455
|
However, one of the major stumbling blocks is just constructing everything in the spec
|
401
|
-
directory which retrospec does for you automatically. Its now up to you to further enhance your test suite with more
|
402
|
-
tests and conditional logic using describe blocks and such. You will notice that some variables are not resolved.
|
403
|
-
Currently this is a limitation that I hope to overcome, but until now its up to you to manually resolve those variables
|
404
|
-
prefixed with a '$'.
|
456
|
+
directory which retrospec does for you automatically. Its now up to you to further enhance your test suite with more tests and conditional logic using describe blocks and such. You will notice that some variables are not resolved. Currently this is a limitation that I hope to overcome, but until now its up to you to manually resolve those variables prefixed with a '$'.
|
405
457
|
|
406
458
|
Example:
|
407
459
|
|
@@ -419,134 +471,42 @@ For now you will probably want to read up on the following documentation:
|
|
419
471
|
* [Puppet spec helper](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/master/README.markdown)
|
420
472
|
|
421
473
|
|
422
|
-
How Does it do this
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
Overriding the Templates
|
429
|
-
=======================
|
430
|
-
There may be a time when you want to override the default templates used to generate the rspec related files.
|
431
|
-
By default retrospec will clone these [templates](https://github.com/nwops/retrospec-templates)
|
432
|
-
and place inside the default or specified template directory. Previously the templates were kept inside the gem
|
433
|
-
and cloning was not required. However, after using retrospec for a few months it makes more sense to keep these templates
|
434
|
-
versioned controlled in their own repo and update them before each retrospec use. This also makes it easy for team
|
435
|
-
contributions to be spread to other team members quickly.
|
436
|
-
|
474
|
+
## How Does it do this
|
475
|
+
Basically Retrospec uses the puppet lexer and parser to scan your code in order to fill out some basic templates that will retrofit your puppet module with unit tests. Currently I rely on the old AST parser to generate all this. This is why puppet 3.7 is vendored into the gem.
|
476
|
+
|
477
|
+
## Overriding the Templates
|
478
|
+
There may be a time when you want to override the default templates used to generate the rspec related files. By default retrospec will clone these [templates](https://github.com/nwops/retrospec-templates) and place inside the default or specified template directory.
|
479
|
+
|
437
480
|
```shell
|
438
|
-
|
439
|
-
|
440
|
-
|
481
|
+
-t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates) (default: /Users/cosman/github/retrospec-templates)
|
482
|
+
-s, --scm-url=<s> SCM url for retrospec templates (default: git@github.com:nwops/retrospec-templates.git)
|
483
|
+
-b, --branch=<s> Branch you want to use for the retrospec template repo (default: master)
|
441
484
|
|
442
485
|
```
|
443
486
|
|
444
487
|
### Environment variables to set template defaults
|
445
|
-
|
446
488
|
RETROSPEC_PUPPET_SCM_URL # set this to auto set your scm url to the templates
|
447
489
|
RETROSPEC_PUPPET_SCM_BRANCH # set this to auto checkout a particular branch (only works upon initial checkout)
|
448
490
|
|
449
|
-
After running retrospec, retrospec will clone the templates from the default template url or from whatever you set to the templates path.
|
450
|
-
If you have already created the erb file in the templates location, then retrospec will not overwrite the file as there will
|
451
|
-
be a SCM conflict.
|
452
|
-
You can use multiple template paths if you use them for different projects so just be sure the set the correct
|
453
|
-
template option when running retrospec. `retrospec -t`
|
491
|
+
After running retrospec, retrospec will clone the templates from the default template url or from whatever you set to the templates path. If you have already created the erb file in the templates location, then retrospec will not overwrite the file as there will be a SCM conflict. You can use multiple template paths if you use them for different projects so just be sure the set the correct template option when running retrospec. `retrospec -t`
|
454
492
|
|
455
|
-
The default user location for the templates when not using `retrospec -t` variable is ~/.
|
493
|
+
The default user location for the templates when not using `retrospec -t` variable is ~/.retrospec/repos/retrospec-puppet-templates
|
456
494
|
|
457
495
|
Example:
|
458
496
|
`--template-dir=~/my_templates`
|
459
497
|
|
460
|
-
|
461
|
-
|
462
|
-
don't give me everything I want. Thus I will need to override the templates for each client.
|
463
|
-
|
464
|
-
```shell
|
465
|
-
retrospec puppet --template-dir ~/retrspec_client1
|
466
|
-
retrospec puppet --template-dir ~/retrspec_client2
|
467
|
-
retrospec puppet --template-dir ~/retrspec_client3
|
468
|
-
touch ~/retrspec_client1/module_files/special_file_for_client1.yml
|
469
|
-
touch ~/retrspec_client2/module_files/special_file_for_client2.yml
|
470
|
-
touch ~/retrspec_client3/module_files/special_file_for_client3.yml
|
471
|
-
|
472
|
-
mkdir -p ~/{client1,client2, client3}
|
473
|
-
cd ~/client1 && puppet module generate lmc-module1
|
474
|
-
cd ~/client2 && puppet module generate lmc-module1
|
475
|
-
cd ~/client3 && puppet module generate lmc-module1
|
476
|
-
|
477
|
-
cd ~/client1/module1 && retrospec --template-dir ~/retrspec_client1
|
478
|
-
cd ~/client2/module1 && retrospec --template-dir ~/retrspec_client2
|
479
|
-
cd ~/client3/module1 && retrospec --template-dir ~/retrspec_client3
|
480
|
-
```
|
481
|
-
Now when you run retrospec just pass in the template path for the specified client and the files will be created as you
|
482
|
-
specified in each clients template directory.
|
483
|
-
|
484
|
-
Adding New Templates
|
485
|
-
======================
|
486
|
-
Should you ever need to add new templates or normal files of any kind retrospec will automatically render and copy the template file
|
487
|
-
to the module path if you place a file inside the `template_path/module_files` directory. The cool thing about this feature
|
488
|
-
is that retrospec will recursively create the same directory structure you make inside the `module_files` directory inside your
|
489
|
-
module. Files do not need to end in .erb will still be rendered as a erb template. Symlinks will be preserved and not
|
490
|
-
dereferenced.
|
491
|
-
|
492
|
-
This follows the convention over configuration pattern so no directory name or filename is required when running retrospec.
|
493
|
-
Just put the template file in the directory where you want it (under module_files) and name it exactly how you want it to appear in the module and retrospec
|
494
|
-
will take care of the rest. Please note that any file ending in .erb will have this extension automatically removed.
|
495
|
-
|
496
|
-
Example:
|
497
|
-
So lets say you want to add a .gitlab-ci.yaml file to all of your modules in your modules directory.
|
498
|
-
|
499
|
-
```shell
|
500
|
-
touch ~/.retrospec_templates/module_files/.gitlab-ci.yaml
|
501
|
-
|
502
|
-
tree ~/.retrospec_templates -a
|
503
|
-
./.retrospec_templates
|
504
|
-
├── acceptance_spec_test.erb
|
505
|
-
├── module_files
|
506
|
-
│ ├── .fixtures.yml
|
507
|
-
│ ├── .gitignore.erb
|
508
|
-
│ ├── .gitlab-ci.yaml
|
509
|
-
│ ├── .travis.yml
|
510
|
-
│ ├── Gemfile
|
511
|
-
│ ├── README.markdown
|
512
|
-
│ ├── Rakefile
|
513
|
-
│ ├── Vagrantfile
|
514
|
-
│ └── spec
|
515
|
-
│ ├── acceptance
|
516
|
-
│ │ └── nodesets
|
517
|
-
│ │ └── ubuntu-server-1404-x64.yml
|
518
|
-
│ ├── shared_contexts.rb
|
519
|
-
│ ├── spec_helper.rb
|
520
|
-
│ └── spec_helper_acceptance.rb
|
521
|
-
└── resource_spec_file.erb
|
522
|
-
|
523
|
-
for dir in ../modules/*; do
|
524
|
-
name=`basename $dir`
|
525
|
-
retrospec -m $dir -e
|
526
|
-
+ /Users/user1/modules/module1/.gitlab-ci.yaml
|
527
|
-
done
|
528
|
-
|
529
|
-
```
|
530
|
-
|
531
|
-
Beaker Testing
|
532
|
-
=================
|
533
|
-
Beaker is Puppetlabs acceptance testing framework that you use to test puppet code on real machines. Beaker is fairly new
|
534
|
-
and is subject to frequent changes. Testing patterns have not been established yet so consider beaker support in puppet-retrospec
|
498
|
+
## Beaker Testing
|
499
|
+
Beaker is Puppetlabs acceptance testing framework that you use to test puppet code on real machines. Beaker is fairly new and is subject to frequent changes. Testing patterns have not been established yet so consider beaker support in puppet-retrospec
|
535
500
|
to be experimental.
|
536
501
|
|
537
|
-
If you wish to enable the creation of beaker tests you can use the following cli option. By default these
|
538
|
-
acceptance tests are not created. However at a later time they will be enabled by default.
|
502
|
+
If you wish to enable the creation of beaker tests you can use the following cli option. By default these acceptance tests are not created. However at a later time they will be enabled by default.
|
539
503
|
|
540
504
|
`--enable-beaker-tests`
|
541
505
|
|
542
|
-
I am no expert in Beaker so if you see an issue with the templates, acceptance_spec_helper or other workflow, please issue
|
543
|
-
a PR.
|
506
|
+
I am no expert in Beaker so if you see an issue with the templates, acceptance_spec_helper or other workflow, please issue a PR.
|
544
507
|
|
545
|
-
Troubleshooting
|
546
|
-
|
547
|
-
If you see the following, this error means that you need to add a fixture to the fixtures file.
|
548
|
-
At this time I have no idea what your module requires. So just add the module that this class belongs to
|
549
|
-
in the .fixtures file.
|
508
|
+
## Troubleshooting
|
509
|
+
If you see the following, this error means that you need to add a fixture to the fixtures file. At this time I have no idea what your module requires. So just add the module that this class belongs to in the .fixtures file.
|
550
510
|
|
551
511
|
See [fixtures doc](https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures) for more information
|
552
512
|
|
@@ -558,8 +518,7 @@ See [fixtures doc](https://github.com/puppetlabs/puppetlabs_spec_helper#using-fi
|
|
558
518
|
# ./spec/defines/instance/source_spec.rb:34:in `block (2 levels) in <top (required)>'
|
559
519
|
```
|
560
520
|
|
561
|
-
If you see something like the following, this means your current module is using a much older version of Rspec. Retrospec
|
562
|
-
uses Rspec 3 syntax so you need to update your rspec version. If you have tests that using older rspec syntax, take a look
|
521
|
+
If you see something like the following, this means your current module is using a much older version of Rspec. Retrospec uses Rspec 3 syntax so you need to update your rspec version. If you have tests that using older rspec syntax, take a look
|
563
522
|
at [transpec](https://github.com/yujinakayama/transpec)
|
564
523
|
|
565
524
|
```shell
|
@@ -571,18 +530,14 @@ at [transpec](https://github.com/yujinakayama/transpec)
|
|
571
530
|
|
572
531
|
```
|
573
532
|
|
574
|
-
If your tests will not run after running retrospec. Your spec_helper, Rakefile and Gemfile may not be compatible
|
575
|
-
with the pre-defined templates. Just delete these files and re-run retrospec to recreate them. Add back any modifications
|
576
|
-
you might have had.
|
533
|
+
If your tests will not run after running retrospec. Your spec_helper, Rakefile and Gemfile may not be compatible with the pre-defined templates. Just delete these files and re-run retrospec to recreate them. Add back any modifications you might have had.
|
577
534
|
|
578
|
-
Running Retrospec Tests
|
579
|
-
|
580
|
-
Puppet-retrospec tests its code against real modules downloaded directly from puppet forge.
|
581
|
-
We also do a little mocking as well but for the majority of the tests we download are 'fixtures'.
|
535
|
+
## Running Retrospec Tests
|
536
|
+
Puppet-retrospec tests its code against real modules downloaded directly from puppet forge.
|
582
537
|
|
583
538
|
To run a clean test suite and re-download you must run with environment variable set
|
584
539
|
```
|
585
|
-
RETROSPEC_CLEAN_UP_TEST_MODULES=true bundle exec rake spec
|
540
|
+
RETROSPEC_CLEAN_UP_TEST_MODULES=true bundle exec rake spec
|
586
541
|
```
|
587
542
|
|
588
543
|
Otherwise to save time we skip the removal of test puppet modules therefore we don't re-download
|
@@ -590,29 +545,21 @@ Otherwise to save time we skip the removal of test puppet modules therefore we d
|
|
590
545
|
bundle exec rake spec
|
591
546
|
```
|
592
547
|
|
593
|
-
Understanding Variable Resolution
|
594
|
-
|
595
|
-
I do my best to try and resolve all the variables. Because the code does not rely on catalog compilation we have to
|
596
|
-
build our own scope through non trival methods. Some variables will get resolved while others will not. As this code
|
597
|
-
progresses we might find a better way at resolving variables. For now, some variable will require manual interpolation.
|
548
|
+
## Understanding Variable Resolution
|
549
|
+
Because the code does not rely on catalog compilation we have to build our own scope through non trival methods. Some variables will get resolved while others will not. As this project progresses we might find a better way at resolving variables. For now, some variable will require manual interpolation.
|
598
550
|
|
599
|
-
Resolution workflow.
|
551
|
+
### Variable Resolution workflow.
|
600
552
|
|
601
553
|
1. load code in parser and find all parameters. Store these parameter values.
|
602
554
|
2. Find all vardef objects, resolve them if possible and store the values
|
603
555
|
3. Anything contained in a block of code is currently ignored, until later refinement.
|
604
556
|
|
605
|
-
Future Parser Support
|
606
|
-
|
607
|
-
Currently Retrospec uses the old/current AST parser for code parsing. If your code contains future parser syntax
|
608
|
-
the current parser will fail to render some resource definitions but will still render the spec file template without parameters
|
557
|
+
##Future Parser Support
|
558
|
+
Currently Retrospec uses the old/current AST parser for code parsing. If your code contains future parser syntax the current parser will fail to render some resource definitions but will still render the spec file template without parameters
|
609
559
|
and resource tests that are contained in your manifest. Retrospec is still extremely useful with Puppet 4.
|
560
|
+
|
610
561
|
Since Puppet 4 introduces many new things and breaks many other things I am not sure
|
611
|
-
which side of the grass is greener at this time. What I do know is that most people are using Puppet 3 and it may take
|
612
|
-
time to move to Puppet 4. I would suspect Retrospec would be more valuable for those moving to Puppet 4
|
613
|
-
who don't have unit tests that currently have Puppet 3 codebases. For those with a clean slate and start directly in
|
614
|
-
Puppet 4, Retrospec will still be able to produce the templates but some of the test cases will be missing if the old AST
|
615
|
-
parser cannot read future code syntax. If your puppet 4 codebase is compatible with puppet 3 syntax there should not be an issue.
|
562
|
+
which side of the grass is greener at this time. What I do know is that most people are using Puppet 3 and it may take time to move to Puppet 4. I would suspect Retrospec would be more valuable for those moving to Puppet 4 who don't have unit tests that currently have Puppet 3 codebases. For those with a clean slate and start directly in Puppet 4, Retrospec will still be able to produce the templates but some of the test cases will be missing if the old AST parser cannot read future code syntax. If your puppet 4 codebase is compatible with puppet 3 syntax there should not be an issue.
|
616
563
|
|
617
564
|
In order to allow future parser validation please run retrospec with the following option.
|
618
565
|
|
@@ -621,18 +568,9 @@ In order to allow future parser validation please run retrospec with the followi
|
|
621
568
|
|
622
569
|
```
|
623
570
|
|
624
|
-
|
625
|
-
============
|
626
|
-
- Add support to fill out used facts in the unit tests automatically
|
627
|
-
- Add describe blocks around conditions in test code that change the catalog compilation
|
628
|
-
- Auto add dependencies to fixtures file
|
629
|
-
- Show a diff of the test file when retrospec is run multiple times and the test file is already created.
|
630
|
-
|
631
|
-
Ruby Support
|
632
|
-
============
|
571
|
+
##Ruby Support
|
633
572
|
Currently this library only supports ruby >= 1.9.3. It might work on 1.8.7 but I won't support if it fails.
|
634
573
|
|
635
|
-
Paid Support
|
636
|
-
============
|
574
|
+
##Paid Support
|
637
575
|
Want to see new features developed much faster? Contact me about a support contract so I can develop this tool during
|
638
|
-
the day instead of after work. contact:
|
576
|
+
the day instead of after work. contact: corey@nwops.io
|