juju / amulet

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

Adding charm X while cwd is X is tricky #173

Open simonklb opened 7 years ago

simonklb commented 7 years ago

Had to dig through the code a bit before finding out what was happening.

In deployer the name of the directory you're in becomes the default charm name that is looked up when determining the charm path. In my case my cwd was /home/ubuntu and I was trying to add the Ubuntu charm to my Amulet test. But every time I was running the test I ended up with Exception: Charm not found.

The reason was that it was trying to lookup the charm as a local charm rather than from the charmstore due to https://github.com/juju/amulet/blob/master/amulet/charm.py#L54 and then https://github.com/juju/amulet/blob/master/amulet/charm.py#L39.

Fixed it by setting the JUJU_TEST_CHARM environment variable, but it wasn't very obvious from the get go what was going on.