2b963fa4b1
Instances will currently alternate between BUILD->ACTIVE->BUILD->ACTIVE on create. This was happening because a race condition existed between the datastore sending heartbeats that the service is ACTIVE before and the prepare call manually stopping the service to bring the status back to BUILD. The fix is to add an optional param force to set_status that is going to be set to True for end_install_or_restart which is called at the end of prepare for all datastores either directly or through app.complete_install_or_restart(). When set_status is called it will now check if the instance status was currently BUILDING and if the force flag is False. This means that the prepare call has not yet finished and to skip the heartbeat from updating the status. Once prepare is finished it will call complete_install_or_restart which will in turn call end_install_or_restart and force the status to be updated from BUILD to ACTIVE. If setting status to FAILED or BUILD_PENDING it will never skip the heartbeat. For mongodb I added complete_install_or_restart to service.py to be called at the end of prepare for single instance mongo instead of calling set_status directly to RUNNING. Cleaned up BaseDbStatusTests and added new tests covering new logic. Change-Id: I7cbd5667e27608edef9755280a8f072495839e1d Closes-Bug: 1482795 |
||
---|---|---|
apidocs | ||
contrib | ||
devstack | ||
doc | ||
etc | ||
tools | ||
trove | ||
.coveragerc | ||
.gitignore | ||
.gitreview | ||
.testr.conf | ||
CONTRIBUTING.rst | ||
LICENSE | ||
MANIFEST.in | ||
README.rst | ||
babel.cfg | ||
doc-test.conf | ||
generate_examples.py | ||
requirements.txt | ||
run_tests.py | ||
run_tests.sh | ||
setup.cfg | ||
setup.py | ||
test-requirements.txt | ||
tox.ini |
README.rst
Trove
Trove is Database as a Service for OpenStack.
Usage for integration testing
If you'd like to start up a fake Trove API daemon for integration testing with your own tool, run:
$ ./tools/start-fake-mode.sh
Stop the server with:
$ ./tools/stop-fake-mode.sh
Tests
To run all tests and PEP8, run tox, like so:
$ tox
To run just the tests for Python 2.7, run:
$ tox -epy27
To run just PEP8, run:
$ tox -epep8
To generate a coverage report,run:
$ tox -ecover
(note: on some boxes, the results may not be accurate unless you run it twice)
If you want to run only the tests in one file you can use testtools e.g.
$ python -m testtools.run trove.tests.unittests.python.module.path