Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation and test configuration #52

Open
bittner opened this issue Oct 24, 2017 · 2 comments
Open

Add validation and test configuration #52

bittner opened this issue Oct 24, 2017 · 2 comments

Comments

@bittner
Copy link

bittner commented Oct 24, 2017

As proposed in puppetlabs/pdk#333 this repository should serve as a default setup for control repositories generated by PDK.

Hence, we should add a Gemfile, .gitignore, .rubocop.yml (and optionally proposed CI configuration and other files?) that allow running validation and testing in a simple fashion via PDK (see below). Sample files are included in the Puppet Labs pdk-module-template repository.

Example Workflow (PDK)

# create control repo
$ pdk new control
# run static analysis tools
$ pdk validate
# run tests
$ pdk test unit
@bschonec
Copy link

bschonec commented May 9, 2024

How about adding some simple spec test examples? I'm stumped as to how to add spec testing to my control-repo as the manifest aren't in 'standard' locations.

@garrettrowell
Copy link

@bschonec generally speaking when spec testing in a control-repo there are two paths to choose from:

Personally, I prefer going the onceover route over the 'roll your own' approach. With that being said I've implemented it both ways before.

Going back to your previous comment, I do find value leveraging the pdk in this scenario as well.

Any files that you don't want the pdk to add in can always be removed by adding something along the lines of this (picking on appveyor):

appveyor.yml:
  delete: true

to a .sync.yml file before running a pdk convert or if this has already been done running pdk update.

If using the pdk I also recommend setting the PDK_FEATURE_FLAGS=controlrepo environment variable, and using the latest version of the pdk.

To leverage onceover a .sync.yml file might look similar to this:

Gemfile:
  optional:
    ':development':
      - gem: 'onceover'
Rakefile:
  requires:
    - require: 'onceover/rake_tasks'
      conditional: "Gem.loaded_specs.key? 'onceover'"
.fixtures.yml:
  unmanaged: true
spec/spec_helper.rb:
  delete: true
.gitignore:
  paths:
    - '.onceover'

We do also have a community slack: https://slack.puppet.com/

There's a testing channel which would be the best place for queries such as this, or if you'd prefer feel free to DM me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants