charm-glance/tests
Corey Bryant 8820389952 Amulet test fixes:
* Makefile: Only run precise-icehouse and trusty-icehouse tests by default
    and increase test timeout
  * t/00-setup: Add more required dependencies
  * t/README: Mention charm-tools dependency
  * t/basic_deployment.py:
    - Specify unstable charm deployment
    - Use dicts in add_services
    - Rename restart test
    - Only set one config option for restart test
    - Cleanup on test failure
2014-10-08 20:18:38 +00:00
..
charmhelpers Resync, rebase 2014-10-01 23:14:32 +01:00
00-setup Amulet test fixes: 2014-10-08 20:18:38 +00:00
10-basic-precise-essex add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
11-basic-precise-folsom add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
12-basic-precise-grizzly add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
13-basic-precise-havana add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
14-basic-precise-icehouse add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
15-basic-trusty-icehouse add basic file-backed glance amulet charm tests 2014-07-11 14:11:03 +00:00
basic_deployment.py Amulet test fixes: 2014-10-08 20:18:38 +00:00
README Amulet test fixes: 2014-10-08 20:18:38 +00:00

This directory provides Amulet tests that focus on verification of Glance
deployments.

In order to run tests, you'll need charm-tools installed (in addition to
juju, of course):
    sudo add-apt-repository ppa:juju/stable
    sudo apt-get update
    sudo apt-get install charm-tools

If you use a web proxy server to access the web, you'll need to set the
AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.

The following examples demonstrate different ways that tests can be executed.
All examples are run from the charm's root directory.

  * To run all tests (starting with 00-setup):

      make test

  * To run a specific test module (or modules):

      juju test -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse

  * To run a specific test module (or modules), and keep the environment
    deployed after a failure:

      juju test --set-e -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse

  * To re-run a test module against an already deployed environment (one
    that was deployed by a previous call to 'juju test --set-e'):

      ./tests/15-basic-trusty-icehouse


For debugging and test development purposes, all code should be idempotent.
In other words, the code should have the ability to be re-run without changing
the results beyond the initial run.  This enables editing and re-running of a
test module against an already deployed environment, as described above.


Notes for additional test writing:

  * Use DEBUG to turn on debug logging, use ERROR otherwise.
      u = OpenStackAmuletUtils(ERROR)
      u = OpenStackAmuletUtils(DEBUG)

  * To interact with the deployed environment:
      export OS_USERNAME=admin
      export OS_PASSWORD=openstack
      export OS_TENANT_NAME=admin
      export OS_REGION_NAME=RegionOne
      export OS_AUTH_URL=${OS_AUTH_PROTOCOL:-http}://`juju-deployer -e trusty -f keystone`:5000/v2.0
      keystone user-list
      glance image-list

  * Preserving the deployed environment:
    Even with juju --set-e, amulet will tear down the juju environment
    when all tests pass.  This force_fail 'test' can be used in basic_deployment.py
    to simulate a failed test and keep the environment.

    def test_zzzz_fake_fail(self):
        '''Force a fake fail to keep juju environment after a successful test run'''
        # Useful in test writing, when used with:   juju test --set-e
        amulet.raise_status(amulet.FAIL, msg='using fake fail to keep juju environment')