Testing Ganeti is done by unit tests and by QA. On this wikipage, we document our QA design and setup.
You can run QA on our public BuildBot setup or on your own test cluster. (TODO: document that).
The QA scripts can and should be extend when functionality of Ganeti grows. The QA scripts reside in the qa
directory in the repository. Consider the following steps:
ganeti-qa.py
.qa_something.py
, don't forget to add it to the Makefile.in
and run make pylint-qa
to lint your changes.RunTest(...)
instead of RunTestIf(...)
. Of course, in this case your scripts must use some reasonable defaults, since no (new) configuration is available.These are a couple of ideas that stand behind QA. Try to comply to them when you extend the QA scripts. If you think, there should be more here, feel free to extend the list.
gnt-xxx
info commands is in YAML, which makes it easy to parse and check the outcome of the tests.The QA files and their purposes:
ganeti-qa
, main script to run the QAqa_entity
for the various entities of a cluster, like qa_node
, qa_instance
qa_config
contains utility functions to deal with the QA configqa_error
contains definitions of exceptionsqa_util
contains various helper functionsThe QA scripts should depend as little as possible on the Ganeti code. This is not strictly the case right now, since we are dependent on constants.py
for example, but generally we should try to not add more dependencies.
The different qa_entity
scripts should not depend on each other. If you have a test that covers more than one entity, you should add this test to the main ganeti-qa
script.
gnt-cluster init
.cluster verify
at the end of each test.qa_config
contains various utility functions to deal with the configuration of the QA.
In particular, it provides functions to acquire nodes and instances.
Most of the tests are single steps in the QA run, except for the instance loop, which loops over a set of disk templates and tests various instance tests on each of those instances.
All the tests enabled in the configuration file are run. If some test is not supported (eg, it doesn‘t make sense or it’s broken), it's the responsibility of the single test to check if the cluster/instance state makes sense for the test or return early. qa_instance.py
and qa_config.py
contain helper functions that simplify checking for such conditions, e.g., IsFailoverSupported
, IsMigrationSupported
in the former, and IsTemplateSupported
in the latter.