Tempest Tests

Manila’s functional API and scenario tests are in the manila tempest plugin repository.

Installation of plugin to tempest

Tempest plugin installation is common for all its plugins and detailed information can be found in its docs. In simple words: if you have installed manila project on the same machine as tempest, then tempest will find it.

In case the plugin is not installed (see the verification steps below), you can clone and install it yourself.

$ git clone https://opendev.org/openstack/manila-tempest-plugin
$ pip install -e manila-tempest-plugin

Verifying installation

To verify that the plugin is installed on your system, run the following command and find “manila_tests” in its output.

$ tempest list-plugins

Alternatively, or to double-check, list all the tests available on the system and find manila tests in it.

$ tempest run -l

Running tests

To run tests, it is required to install pip, tox and virtualenv packages on host machine. Then run following command from tempest root directory:

$ tempest run -r manila_tempest_tests.tests.api

or to run only scenario tests:

$ tempest run -r manila_tempest_tests.tests.scenario

Running a subset of tests based on test location

Instead of running all tests, you can specify an individual directory, file, class, or method that contains test code.

To run the tests in the manila_tempest_tests/tests/api/admin directory:

$ tempest run -r manila_tempest_tests.tests.api.admin

To run the tests in the manila_tempest_tests/tests/api/admin/test_admin_actions.py module:

$ tempest run -r manila_tempest_tests.tests.api.admin.test_admin_actions

To run the tests in the AdminActionsTest class in manila_tempest_tests/tests/api/admin/test_admin_actions.py module:

$ tempest run -r manila_tempest_tests.tests.api.admin.test_admin_actions.AdminActionsTest

To run the AdminActionsTest.test_reset_share_state test method in manila_tempest_tests/tests/api/admin/test_admin_actions.py module:

$ tempest run -r manila_tempest_tests.tests.api.admin.test_admin_actions.AdminActionsTest.test_reset_share_state

Running a subset of tests based on service involvement

To run the tests that require only manila-api service running:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\bapi\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)

To run the tests that require all manila services running, but intended to test API behaviour:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\b\(api\|api_with_backend\)\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)

To run the tests that require all manila services running, but intended to test back-end (manila-share) behaviour:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\bbackend\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)

Running a subset of positive or negative tests

To run only positive tests, use following command:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\bpositive\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)

To run only negative tests, use following command:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\bnegative\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)

To run only positive API tests, use following command:

$ tempest run -r \
  \(\?\=\.\*\\\[\.\*\\bpositive\\b\.\*\\\]\) \
  \(\?\=\.\*\\\[\.\*\\bapi\\b\.\*\\\]\) \
  \(\^manila_tempest_tests.tests.api\)