juju / amulet

Testing harness and tools for Juju Charms
Other
17 stars 33 forks source link

Add better support for testing relation operations #154

Open simonklb opened 8 years ago

simonklb commented 8 years ago

Currently, I haven't been able to find an easy way to test adding, removing and readding relations properly using Amulet.

The solution I've come up with so far is using wait_for_message function in conjunction with the relation function in sentry and polling it continuously until it gives the appropriate response (throwing the "Relationship not found" exception in the case of removal).

Until recently this have worked fairly well. But now the tests have started to light up red due to the relation states (i.e. xxxx.available etc) not being active. After debugging it, the problem seem to be removing and then re-adding the relations too quickly which makes the *-joined hooks never fire.

Whether or not this is a Juju issue or an Amulet issue I leave up to you to decide. But as important as this is for the charm to work properly, adding and removing relations should be something that is tested thoroughly.