augeasproviders

Alternative Augeas-based providers for Puppet

Browse collection: herculesteam

Latest version: 2.1.3 (changelog)

Home

Setup

Providers

Examples

Classes

Other docs

Contributing to augeasproviders

Build Status

Writing tests

Tests for a typename provider live at spec/unit/puppet/typename_spec.rb and their corresponding fixture (starting file) under spec/fixture/unit/puppet/typename/.

Use an rspec context section per fixture and have multiple examples within the section using it.

Tests use real resources which are applied via the AugeasSpec::Fixtures::apply method to a temporary file created from the original fixture. Once applied, the temporary file is tested using one of two methods:

  1. Load file with ruby-augeas (aug_open helper) and perform match/get queries to test particular features of the tree.
  2. Define whole or part of the tree in augparse { } syntax and use augparse or augparse_filter helpers to compare the file against the expected tree.

The latter will be much easier and more robust as it will compare all aspects of the tree, while the first might be needed for some edge cases (empty files etc).

See also this writeup on testing techniques for Puppet providers using Augeas which shows this process for augeasproviders.

Execute rake spec in the root directory to run all tests.

Thoughts about testing methods

After applying the resource, there are a few ways we could test the results of the file.

Requirements

Install bundler and run bundle install to get all gems required for development or see the contents of Gemfile.

Patches

Please send pull requests via GitHub, or patches via git send-email to the author.