Advice on unit testing reactive handlers?
Stuart Bishop
stuart.bishop at canonical.com
Mon Apr 11 03:13:24 UTC 2016
On 10 April 2016 at 22:31, Pete Vander Giessen <petevg at gmail.com> wrote:
> Hello All,
>
> I'm currently working on writing a layered charm, and I had a question about
> unit (or unit-ish) testing. Is it practical to write unit test for, say,
> helpers for a reactive handler? Does anybody have any favorite examples they
> can point me at?
>
> There's a lot of awesome automagic in a juju charm, but I'm having a little
> trouble setting up paths and environments with that magic mocked out for
> unit-style tests. :-/
>
> (The reason I'm trying to write smaller tests is that I'd like to speed up
> my testing cycle while I'm still in the obvious mistakes and silly typos
> stage of writing the charm)
https://git.launchpad.net/postgresql-charm has both unit and integration tests.
https://git.launchpad.net/postgresql-charm/tree/tests/test_postgresql.py
are the bulk of the unit tests, testing the helpers in
reactive/postgresql/postgresql.py.
--
Stuart Bishop <stuart.bishop at canonical.com>
More information about the Juju
mailing list