amulet
amulet copied to clipboard
Update docs to warn about dangers of hardcoding unit numbers in tests
For example:
# bad
sentry.unit['mysql/0']
# good
sentry.unit['mysql'][0]
The reason for this is that bundletester, by default, resets the env between test file executions. So, unit numbers for the running test may not start at zero if the test is not the first to run in the env. Not that env resets can be disabled via the tests.yaml file.
we should just tell people
sentry['mysql/0'] # bad
sentry['mysql'][0] # better
since sentry is also a list? and we don't confuse a service key with the unit lookup
On Tue, Sep 22, 2015 at 12:22 PM Tim Van Steenburgh < [email protected]> wrote:
For example:
bad
sentry.unit['mysql/0']
good
sentry.unit['mysql'][0]
The reason for this is that bundletester, by default, resets the env between test file executions. So, unit numbers for the running test may not start at zero if the test is not the first to run in the env. Not that env resets can be disabled via the tests.yaml file.
— Reply to this email directly or view it on GitHub https://github.com/juju/amulet/issues/97.