test_configuration
simulates provisioning a server but with a faster feedback loop.
In order to test for a successful puppet run, we've created a test environment with Docker.
The Docker configuration sets up a base CentOS 7 image with a masterless puppet agent in order to run puppet apply
on
a specified manifest.
The Dockerfile copies modules/
and test_configuration/
into the image in order for the puppet agent to access
the manifests.
The test_configuration
manifests combines the module under test and its dependencies.
For example, foo
module requires epel
to be successfully installed.
In order to run smoke tests on foo
we need to include a reference to the epel
class in the test_configuration
foo
manifest:
class test_configuration::foo {
include base::yum::repos::epel
include foo
}
When ready to smoke test a new module, create a corresponding class in test_configuration
:
├── modules/
│ ├── foo/
│ └── *some_new_module/*
├── test_configuration
│ └── manifests/
│ ├── foo.pp
│ └── *some_new_module.pp*
└──
The new class must include the module under test:
class test_configuration::some_new_class {
include some_new_module
}
Once the class is added to the manifest, run the smoke-test.sh
script, passing the class as an argument:
$ ./smoke-test.sh test_configuration::some_new_class
Manifest | Resource | Description |
---|---|---|
monitoring | monitoring.pp |
Description: Tests the manifests contained in monitoring module and the required epel dependency |