~bac/charms/trusty/openstack-dashboard/dashboard-plugin

« back to all changes in this revision

Viewing changes to tests/README

  • Committer: Brad Crittenden
  • Date: 2016-02-17 20:33:55 UTC
  • mfrom: (63.1.11 openstack-dashboard)
  • Revision ID: bac@canonical.com-20160217203355-uay92et202ll924c
MergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This directory provides Amulet tests that focus on verification of
2
 
openstack-dashboard deployments.
3
 
 
4
 
test_* methods are called in lexical sort order, although each individual test
5
 
should be idempotent, and expected to pass regardless of run order.
6
 
 
7
 
Test name convention to ensure desired test order:
 
1
This directory provides Amulet tests to verify basic deployment functionality
 
2
from the perspective of this charm, its requirements and its features, as
 
3
exercised in a subset of the full OpenStack deployment test bundle topology.
 
4
 
 
5
Reference:  lp:openstack-charm-testing for full test bundles.
 
6
 
 
7
A single topology and configuration is defined and deployed, once for each of
 
8
the defined Ubuntu:OpenStack release combos.  The ongoing goal is for this
 
9
charm to always possess tests and combo definitions for all currently-supported
 
10
release combinations of U:OS.
 
11
 
 
12
test_* methods are called in lexical sort order, as with most runners.  However,
 
13
each individual test method should be idempotent and expected to pass regardless
 
14
of run order or Ubuntu:OpenStack combo.  When writing or modifying tests,
 
15
ensure that every individual test is not dependent on another test_ method.
 
16
 
 
17
Test naming convention, purely for code organization purposes:
8
18
    1xx service and endpoint checks
9
19
    2xx relation checks
10
20
    3xx config checks
11
21
    4xx functional checks
12
 
    9xx restarts and other final checks
 
22
    9xx restarts, config changes, actions and other final checks
13
23
 
14
 
In order to run tests, you'll need charm-tools installed (in addition to
15
 
juju, of course):
 
24
In order to run tests, charm-tools and juju must be installed:
16
25
    sudo add-apt-repository ppa:juju/stable
17
26
    sudo apt-get update
18
 
    sudo apt-get install charm-tools
19
 
 
20
 
If you use a web proxy server to access the web, you'll need to set the
21
 
AMULET_HTTP_PROXY environment variable to the http URL of the proxy server.
 
27
    sudo apt-get install charm-tools juju juju-deployer amulet
 
28
 
 
29
Alternatively, tests may be exercised with proposed or development versions
 
30
of juju and related tools:
 
31
 
 
32
    # juju proposed version
 
33
    sudo add-apt-repository ppa:juju/proposed
 
34
    sudo apt-get update
 
35
    sudo apt-get install charm-tools juju juju-deployer
 
36
 
 
37
    # juju development version
 
38
    sudo add-apt-repository ppa:juju/devel
 
39
    sudo apt-get update
 
40
    sudo apt-get install charm-tools juju juju-deployer
 
41
 
 
42
Some tests may need to download files. If a web proxy server is required in
 
43
the environment, the AMULET_HTTP_PROXY environment variable must be set and
 
44
passed into the juju test command.  This is unrelated to juju's http proxy
 
45
settings or behavior.
22
46
 
23
47
The following examples demonstrate different ways that tests can be executed.
24
48
All examples are run from the charm's root directory.
25
49
 
26
 
  * To run all tests (starting with 00-setup):
27
 
 
28
 
      make test
29
 
 
30
 
  * To run a specific test module (or modules):
31
 
 
32
 
      juju test -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse
33
 
 
34
 
  * To run a specific test module (or modules), and keep the environment
35
 
    deployed after a failure:
36
 
 
37
 
      juju test --set-e -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse
 
50
  * To run all +x tests in the tests directory:
 
51
 
 
52
      bzr branch lp:charms/trusty/foo
 
53
      cd foo
 
54
      make functional_test
 
55
 
 
56
  * To run the tests against a specific release combo as defined in tests/:
 
57
 
 
58
      bzr branch lp:charms/trusty/foo
 
59
      cd foo
 
60
      juju test -v -p AMULET_HTTP_PROXY 015-basic-trusty-icehouse
 
61
 
 
62
  * To run tests and keep the juju environment deployed after a failure:
 
63
 
 
64
      bzr branch lp:charms/trusty/foo
 
65
      cd foo
 
66
      juju test --set-e -v -p AMULET_HTTP_PROXY 015-basic-trusty-icehouse
38
67
 
39
68
  * To re-run a test module against an already deployed environment (one
40
69
    that was deployed by a previous call to 'juju test --set-e'):
41
70
 
42
 
      ./tests/15-basic-trusty-icehouse
43
 
 
44
 
For debugging and test development purposes, all code should be idempotent.
45
 
In other words, the code should have the ability to be re-run without changing
46
 
the results beyond the initial run.  This enables editing and re-running of a
47
 
test module against an already deployed environment, as described above.
48
 
 
49
 
Manual debugging tips:
50
 
 
51
 
  * Set the following env vars before using the OpenStack CLI as admin:
52
 
      export OS_AUTH_URL=http://`juju-deployer -f keystone 2>&1 | tail -n 1`:5000/v2.0
53
 
      export OS_TENANT_NAME=admin
 
71
      ./tests/015-basic-trusty-icehouse
 
72
 
 
73
  * Even with --set-e, `juju test` will tear down the deployment when all
 
74
    tests pass. The following work flow may be more effective when
 
75
    iterating on test writing.
 
76
 
 
77
      bzr branch lp:charms/trusty/foo
 
78
      cd foo
 
79
      ./tests/setup/00-setup
 
80
      juju bootstrap
 
81
      ./tests/015-basic-trusty-icehouse
 
82
      # make some changes, run tests again
 
83
      ./tests/015-basic-trusty-icehouse
 
84
      # make some changes, run tests again
 
85
      ./tests/015-basic-trusty-icehouse
 
86
 
 
87
  * There may be test definitions in the tests/ dir which are not set +x
 
88
    executable.  This is generally true for deprecated releases, or for
 
89
    upcoming releases which are not yet validated and enabled.  To enable
 
90
    and run these tests:
 
91
      bzr branch lp:charms/trusty/foo
 
92
      cd foo
 
93
      ls tests
 
94
      chmod +x tests/017-basic-trusty-kilo
 
95
      ./tests/setup/00-setup
 
96
      juju bootstrap
 
97
      ./tests/017-basic-trusty-kilo
 
98
 
 
99
 
 
100
Additional notes:
 
101
 
 
102
  * Use DEBUG to turn on debug logging, use ERROR otherwise.
 
103
      u = OpenStackAmuletUtils(ERROR)
 
104
      u = OpenStackAmuletUtils(DEBUG)
 
105
 
 
106
  * To interact with the deployed environment:
54
107
      export OS_USERNAME=admin
55
108
      export OS_PASSWORD=openstack
56
 
      export OS_REGION_NAME=RegionOne
57
 
 
58
 
  * Set the following env vars before using the OpenStack CLI as demoUser:
59
 
      export OS_AUTH_URL=http://`juju-deployer -f keystone 2>&1 | tail -n 1`:5000/v2.0
60
 
      export OS_TENANT_NAME=demoTenant
61
 
      export OS_USERNAME=demoUser
62
 
      export OS_PASSWORD=password
63
 
      export OS_REGION_NAME=RegionOne
 
109
      export OS_TENANT_NAME=admin
 
110
      export OS_REGION_NAME=RegionOne
 
111
      export OS_AUTH_URL=${OS_AUTH_PROTOCOL:-http}://`juju-deployer -e trusty -f keystone`:5000/v2.0
 
112
      keystone user-list
 
113
      glance image-list