language-puppet-1.0.1: Tools to parse and evaluate the Puppet DSL.

Safe HaskellNone
LanguageHaskell98

Puppet.Testing

Synopsis

Documentation

module Puppet.PP

hspec :: Spec -> IO ()

Run given spec and write a report to stdout. Exit with exitFailure if at least one spec item fails.

basicTest :: PSpec Source

This tests that file sources are valid.

usersGroupsDefined :: PSpec Source

This tests that all users and groups used as resource parameters are defined

testingDaemon Source

Arguments

:: PuppetDBAPI IO

Contains the puppetdb API functions

-> FilePath

Path to the manifests

-> (Text -> IO Facts)

The facter function

-> IO (Text -> IO (Either PrettyError (FinalCatalog, EdgeMap, FinalCatalog, [Resource]))) 

Initializes a daemon made for running tests, using the specific test puppetDB

shouldBe :: (Show a, Eq a) => a -> a -> PSpecM Expectation Source

type PSpec = PSpecM () Source

type PSpecM = ReaderT TestEnv SpecM Source

lCatalog :: HasTestEnv c => Lens' c FinalCatalog Source

lModuledir :: HasTestEnv c => Lens' c FilePath Source

lPuppetdir :: HasTestEnv c => Lens' c FilePath Source

withResource Source

Arguments

:: String

The test description (the thing that goes after should)

-> Text

Resource type

-> Text

Resource name

-> (Resource -> Expectation)

Testing function

-> PSpec 

Run tests on a specific resource

withParameter Source

Arguments

:: Text

The parameter name

-> Resource

The resource to test

-> (PValue -> Expectation)

Testing function

-> Expectation 

Tests a specific parameter

withParameters Source

Arguments

:: [(Text, PValue)]

The parameter names and values

-> Resource

The resource to test

-> Expectation 

Test a serie of parameters

withFileContent Source

Arguments

:: String

Test description (the thing that goes after should)

-> Text

The file path

-> (Text -> Expectation)

Testing function

-> PSpec 

Retrieves a given file content, and runs a test on it. It works on the explicit "content" parameter, or can resolve the "source" parameter to open the file.