From cc13bd20036fb2b833a01b4aa164acad9a9695e2 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Jan 2016 21:44:28 +0000 Subject: [PATCH 1/5] remove amulet tests for unsupported releases --- tests/019-basic-vivid-kilo | 9 --------- 1 file changed, 9 deletions(-) delete mode 100755 tests/019-basic-vivid-kilo diff --git a/tests/019-basic-vivid-kilo b/tests/019-basic-vivid-kilo deleted file mode 100755 index e5ab7d8..0000000 --- a/tests/019-basic-vivid-kilo +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/python - -"""Amulet tests on a basic cinder-ceph deployment on vivid-kilo.""" - -from basic_deployment import CinderCephBasicDeployment - -if __name__ == '__main__': - deployment = CinderCephBasicDeployment(series='vivid') - deployment.run_tests() From 195c20143441e59bd8ccbd720eb35f96010671f8 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Jan 2016 21:44:52 +0000 Subject: [PATCH 2/5] Move 00-setup to prevent extra, unnecessary bootstrap in test runs. --- Makefile | 1 + tests/{ => setup}/00-setup | 0 2 files changed, 1 insertion(+) rename tests/{ => setup}/00-setup (100%) diff --git a/Makefile b/Makefile index fb0a2e5..3b8ad5e 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ test: functional_test: @echo Starting Amulet tests... + @tests/setup/00-setup @juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700 bin/charm_helpers_sync.py: diff --git a/tests/00-setup b/tests/setup/00-setup similarity index 100% rename from tests/00-setup rename to tests/setup/00-setup From 2963be9a8441225cbedb21f5b2a293c73ef230e7 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Jan 2016 21:45:12 +0000 Subject: [PATCH 3/5] Re-number amulet test file names; add missing combos as not-executable for now. --- tests/018-basic-trusty-liberty | 11 +++++++++++ tests/019-basic-trusty-mitaka | 11 +++++++++++ tests/020-basic-wily-liberty | 9 +++++++++ tests/021-basic-xenial-mitaka | 9 +++++++++ 4 files changed, 40 insertions(+) create mode 100644 tests/018-basic-trusty-liberty create mode 100644 tests/019-basic-trusty-mitaka create mode 100644 tests/020-basic-wily-liberty create mode 100644 tests/021-basic-xenial-mitaka diff --git a/tests/018-basic-trusty-liberty b/tests/018-basic-trusty-liberty new file mode 100644 index 0000000..5abedcd --- /dev/null +++ b/tests/018-basic-trusty-liberty @@ -0,0 +1,11 @@ +#!/usr/bin/python + +"""Amulet tests on a basic cinder-ceph deployment on trusty-liberty.""" + +from basic_deployment import CinderCephBasicDeployment + +if __name__ == '__main__': + deployment = CinderCephBasicDeployment(series='trusty', + openstack='cloud:trusty-liberty', + source='cloud:trusty-updates/liberty') + deployment.run_tests() diff --git a/tests/019-basic-trusty-mitaka b/tests/019-basic-trusty-mitaka new file mode 100644 index 0000000..5abedcd --- /dev/null +++ b/tests/019-basic-trusty-mitaka @@ -0,0 +1,11 @@ +#!/usr/bin/python + +"""Amulet tests on a basic cinder-ceph deployment on trusty-liberty.""" + +from basic_deployment import CinderCephBasicDeployment + +if __name__ == '__main__': + deployment = CinderCephBasicDeployment(series='trusty', + openstack='cloud:trusty-liberty', + source='cloud:trusty-updates/liberty') + deployment.run_tests() diff --git a/tests/020-basic-wily-liberty b/tests/020-basic-wily-liberty new file mode 100644 index 0000000..7b975eb --- /dev/null +++ b/tests/020-basic-wily-liberty @@ -0,0 +1,9 @@ +#!/usr/bin/python + +"""Amulet tests on a basic cinder-ceph deployment on wily-liberty.""" + +from basic_deployment import CinderCephBasicDeployment + +if __name__ == '__main__': + deployment = CinderCephBasicDeployment(series='wily') + deployment.run_tests() diff --git a/tests/021-basic-xenial-mitaka b/tests/021-basic-xenial-mitaka new file mode 100644 index 0000000..80c6c73 --- /dev/null +++ b/tests/021-basic-xenial-mitaka @@ -0,0 +1,9 @@ +#!/usr/bin/python + +"""Amulet tests on a basic cinder-ceph deployment on xenial-mitaka.""" + +from basic_deployment import CinderCephBasicDeployment + +if __name__ == '__main__': + deployment = CinderCephBasicDeployment(series='xenial') + deployment.run_tests() From 6419d5bfb5e78490c11e7e05959162e71207768d Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Jan 2016 21:45:35 +0000 Subject: [PATCH 4/5] Update tests/README --- tests/README | 121 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 84 insertions(+), 37 deletions(-) diff --git a/tests/README b/tests/README index ef32e29..79c5b06 100644 --- a/tests/README +++ b/tests/README @@ -1,66 +1,113 @@ -This directory provides Amulet tests that focus on verification of -cinder-ceph deployments. +This directory provides Amulet tests to verify basic deployment functionality +from the perspective of this charm, its requirements and its features, as +exercised in a subset of the full OpenStack deployment test bundle topology. -test_* methods are called in lexical sort order. +Reference: lp:openstack-charm-testing for full test bundles. -Test name convention to ensure desired test order: +A single topology and configuration is defined and deployed, once for each of +the defined Ubuntu:OpenStack release combos. The ongoing goal is for this +charm to always possess tests and combo definitions for all currently-supported +release combinations of U:OS. + +test_* methods are called in lexical sort order, as with most runners. However, +each individual test method should be idempotent and expected to pass regardless +of run order or Ubuntu:OpenStack combo. When writing or modifying tests, +ensure that every individual test is not dependent on another test_ method. + +Test naming convention, purely for code organization purposes: 1xx service and endpoint checks 2xx relation checks 3xx config checks 4xx functional checks - 9xx restarts and other final checks + 9xx restarts, config changes, actions and other final checks -Common uses of heat relations in deployments: - - [ cinder, cinder-ceph ] - - [ cinder-ceph, ceph ] - -In order to run tests, you'll need charm-tools installed (in addition to -juju, of course): +In order to run tests, charm-tools and juju must be installed: sudo add-apt-repository ppa:juju/stable sudo apt-get update - sudo apt-get install charm-tools + sudo apt-get install charm-tools juju juju-deployer amulet -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. +Alternatively, tests may be exercised with proposed or development versions +of juju and related tools: + + # juju proposed version + sudo add-apt-repository ppa:juju/proposed + sudo apt-get update + sudo apt-get install charm-tools juju juju-deployer + + # juju development version + sudo add-apt-repository ppa:juju/devel + sudo apt-get update + sudo apt-get install charm-tools juju juju-deployer + +Some tests may need to download files. If a web proxy server is required in +the environment, the AMULET_HTTP_PROXY environment variable must be set and +passed into the juju test command. This is unrelated to juju's http proxy +settings or behavior. 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): + * To run all +x tests in the tests directory: - make test + bzr branch lp:charms/trusty/foo + cd foo + make functional_test - * To run a specific test module (or modules): + * To run the tests against a specific release combo as defined in tests/: - juju test -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse + bzr branch lp:charms/trusty/foo + cd foo + juju test -v -p AMULET_HTTP_PROXY 015-basic-trusty-icehouse - * To run a specific test module (or modules), and keep the environment - deployed after a failure: + * To run tests and keep the juju environment deployed after a failure: - juju test --set-e -v -p AMULET_HTTP_PROXY 15-basic-trusty-icehouse + bzr branch lp:charms/trusty/foo + cd foo + juju test --set-e -v -p AMULET_HTTP_PROXY 015-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 + ./tests/015-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. + * Even with --set-e, `juju test` will tear down the deployment when all + tests pass. The following work flow may be more effective when + iterating on test writing. -Manual debugging tips: + bzr branch lp:charms/trusty/foo + cd foo + ./tests/setup/00-setup + juju bootstrap + ./tests/015-basic-trusty-icehouse + # make some changes, run tests again + ./tests/015-basic-trusty-icehouse + # make some changes, run tests again + ./tests/015-basic-trusty-icehouse - * Set the following env vars before using the OpenStack CLI as admin: - export OS_AUTH_URL=http://`juju-deployer -f keystone 2>&1 | tail -n 1`:5000/v2.0 - export OS_TENANT_NAME=admin + * There may be test definitions in the tests/ dir which are not set +x + executable. This is generally true for deprecated releases, or for + upcoming releases which are not yet validated and enabled. To enable + and run these tests: + bzr branch lp:charms/trusty/foo + cd foo + ls tests + chmod +x tests/017-basic-trusty-kilo + ./tests/setup/00-setup + juju bootstrap + ./tests/017-basic-trusty-kilo + + +Additional notes: + + * 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 - - * Set the following env vars before using the OpenStack CLI as demoUser: - export OS_AUTH_URL=http://`juju-deployer -f keystone 2>&1 | tail -n 1`:5000/v2.0 - export OS_TENANT_NAME=demoTenant - export OS_USERNAME=demoUser - export OS_PASSWORD=password - 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 From fd642bd651382757cff81490f42c69b871091f40 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Jan 2016 21:45:50 +0000 Subject: [PATCH 5/5] Update bundletester testplan yaml file --- tests/tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tests.yaml b/tests/tests.yaml index 64e3e2d..4d17631 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -1,5 +1,5 @@ bootstrap: true -reset: true +reset: false virtualenv: true makefile: - lint @@ -9,6 +9,7 @@ sources: packages: - amulet - distro-info-data + - python-ceilometerclient - python-cinderclient - python-distro-info - python-glanceclient