While writing code for the next features in the Juju GUI I needed to test instances when charms would fail in various stages of their setup or execution. After a lot of messing around it became apparent that most charms are just too stable for this kind of testing so, I wrote a Juju Charm which is designed to fail in a large number of hooks depending on the configuration set on deploy (or later), and can relate to itself to test relation failures.

The charm, innovatively named ‘failtester’, can be found on jujucharms.com. In depth details on proper use can be found in its README but it’s really simple to use:

NOTE: THIS CHARM SHOULD ONLY BE USED FOR JUJU OR JUJU GUI DEVELOPMENT. IT HAS NO OTHER FUNCTIONALITY THAN TO FAIL PREDICTABLY.

// bootstrap your juju environment
juju bootstrap

// deploy the failtester charm
juju deploy cs:~hatch/precise/failtester

// set the failure type you want to occur
// the failtester charm will now fail in its install hook
juju set failtester install=true

KNOWN ISSUE

The charm settings are at the service level which means that any failures happen to every unit of the failtester service. The fix for this should be fairly simple to do but I don’t have any use for it at this time. If you need it feel free to ask or issue a pull request.