To solve the problem of "db type could not be determined" on py34 we
have to run first the py34 env to, then, run py27. This patch puts py34
first on the tox.ini list of envs to avoid this problem to happen.
Change-Id: Id54bb80944385579cfa136fce78cb5be55393f81
Closes-Bug: #1489059
For the moment we can just calculate coverage and generate html with results.
It would be really useful to be able to get 'failure' by this job, when
latest commit introduced reduction of test coverage by any reason - either
addon of new code not covered with unit tests or deletion of existing unit
tests.
It will reduce total required efforts for code reviewers, that are forced now
to perform such check separately and inform about it committer.
Added file 'tools/cover.sh' is taken from OpenStack Rally project as
of state [1], with couple of fixes for satisfying 'bashate'.
Also add configuration file for coverage package.
[1] I7b4defe187c0631928d70bd09d7bcea956f4eed3
Change-Id: Ie0c5721985ae48256d9bb26af5fdb4b05797b359
The desired OS_TEST_DBAPI_ADMIN_CONNECTION string is now reflected
in the oslo.db 1.12.0 release's default behavior, and so does not
need to be set any longer to achieve the same opportunistic backend
discovery for tests.
Change-Id: I9e7239c71371bc872f5ae41e4f0f3c8942f3d9b3
Set the OS_TEST_DBAPI_ADMIN_CONNECTION override variable so that
oslo.db opportunistic detection will know to use PyMySQL until
I12b32dc097a121bd43991bc38dd4d289b65e86c1 makes it the default
behavior.
Change-Id: I1b27cbdc0612ac63501e2f132bab1c065fe9a3ba
Co-Authored-By: Victor Sergeyev <vsergeyev@mirantis.com>
Manila scripts located in bin/* should be covered with unit tests.
In order to add unit tests for bin/* scripts:
- all
- api
- manage
- scheduler
- share
we move them into manila/cmd and use pbr to setup console scripts
which will call the respective main function of each script under manila/cmd.
It will allow us to import from manila.cmd and individually test each 'main' function.
Add unit tests for manila/cmd/* scripts.
Implements bp unit-tests-for-manila-scripts
Change-Id: I9be6b948a6de7ba76405411e98d7531cf225b57e
The program tools/lintstack.py which is executed by
tools/lintstack.sh when Jenkins runs, only tests for differences
in the output of pylint. Right now, there seems to be
17 errors/warnings that are being carried over from fix to fix,
with no difference between fixes, and so no failures in the
pylint Jenkins job.
It is really difficult to tell what the errors are, so this fix
allows developers determine what the errors are by running the
following command:
$ tox -e lint
A sample output of the command is available as an attachment
to the bug.
Change-Id: I88487829576d55d437b934e08571013b7a6e57cf
Signed-off-by: Luis Pabón <lpabon@redhat.com>
Closes-Bug: #1356588
Signed-off-by: Luis Pabón <lpabon@redhat.com>
bashate checks shell script syntax (similar to pep8 for python). Fix
currently available scripts and enable the check for the scripts.
Change-Id: I33dc8c44a58f40e8bca9e29cd717caf46e5cd586
The config module in oslo-incubator has been replaced by oslo.config.
Projects need to switch completely to oslo.config for kilo.
This patch does:
* Register options with oslo.config (new file manila/opts.py)
* Generate the config file using oslo-config-generator
* Remove obsoleted entries for this from openstack-common.conf
* Remove oslo-incubator config files
Change-Id: I30b594423c08782e13a1f615099ae65f997a8551
Closes-Bug: #1382183
tox -e genconfig and tox -e pylint both will generate a warning like:
WARNING:test command found but not installed in testenv
cmd: /bin/bash
env: /home/aj/vcs/OpenStack/openstack/manila/.tox/genconfig
Maybe forgot to specify a dependency?
Whitelist bash to remove the warning.
Change-Id: Ibab38ce2308760c7089d5d3e298bfc642367e7b4
Add manila specific hacking checks (copied over from nova) to test:
- [M319] Validate that debug level logs are not translated.
- [M323] Ensure that the _() function is explicitly imported to ensure
proper translations.
- [M325] str() cannot be used on an exception. Remove use or use
six.text_type()
- [M326] Translated messages cannot be concatenated. String should be
included in translated message.
Also include some tests for the above (copied from nova and adjusted).
Rework HACKING.rst to remove the content that is in the global hacking
file and add in the manila specific rules.
Change-Id: I530609a183c81ba942623b73d5f62cd338b04211
By default, flake8 checks the current directory and its subdirectories,
so it tests already for "." - and "manila/common" is a subdirectory of
it. Thus remove "." and also "manila/common" as subdirectory. Right now
"manila/common" gets tested twice - as part of "." and separate.
Closes-Bug: #1383154
Change-Id: Ie187686bd8b9e9981b2556c1d394fa9a9ca63915
oslo.i18n provides the i18n function that were provided by
oslo-incubator's gettextutils module
Import _ where needed, oslo.i18n deprecated the builtin method.
Closes-Bug: #1382187
Change-Id: I12aa1c725aa4bb52a9aa46e9c3d2b303839de48b
Fix H405:
H405 multi line docstring summary not separated with an empty line
With this patch, flake8 passes all checks (incl. hacking checks)
except the on-purpose disabled check H904.
Closes-Bug: #1333290
Change-Id: If41259aefc4d6d588da5036f1f25df17b88db04f
Fix and enable flake8 test H404:
H404 multi line docstring should start without a leading new line
Change-Id: I13dc13bb5e81d65300680df094cde538c7a6f6df
Partial-Bug: #1333290
Fix and enable E128:
E128 continuation line under-indented for visual indent
Partial-Bug: #1333290
Change-Id: I72f673d291c388fc4df19e9585fb02e23c21fec3
Fix H302 and enable the test:
H302 import only modules.'from X import Y' does not import a module
Fix also in the touched files the following:
E128 continuation line under-indented for visual indent
Change-Id: I3116c030a5dc0b5be2b4413beaa460e483215774
Partial-Bug: #1333290
Enable F841 and fix all issues.
Flake F841 is:
F841 local variable 'XXX' is assigned to but never used
Also fix in changed files some occurences of:
E128 continuation line under-indented for visual indent
H404 multi line docstring should start without a leading new line
H405 multi line docstring summary not separated with an empty line
Change-Id: Ifb08a82d05ac15c8e90f214a96e73d82ff850018
Partial-Bug: #1333290
Add doc venv to align with other OpenStack projects (such as Keystone,
Heat and Nova) who are using 'docs' for their doc builds.
Change-Id: Ib26cdac7142e9ec9efc231a578c14bfc7936ae61
Fix these issues and enable E126 and E127:
E126 continuation line over-indented for hanging indent
E127 continuation line over-indented for visual indent
Also fix a few occurences in the touched files of:
E128 continuation line under-indented for visual indent
H405 multi line docstring summary not separated with an empty line
Partial-Bug: #1333290
Change-Id: If822401fc7e1db49d595a0736a0dff8e00dfd217
Enable the tests and update flake8 comments to note that H904 is ignored
on purpose.
The patch fixes these warnings:
./manila/api/views/limits.py:68:5: E129 visually indented line with same
indent as next logical line
./manila/share/drivers/netapp/cluster_mode.py:352:13: E122 continuation
line missing indentation or outdented
./manila/scheduler/scheduler_options.py:98:13: E129 visually indented
line with same indent as next logical line
./contrib/tempest/tempest/api/share/base.py:210:5: E129 visually
indented line with same indent as next logical line
./contrib/tempest/tempest/api/share/test_rules.py:32:13: E129 visually
indented line with same indent as next logical line
./contrib/tempest/tempest/api/share/test_rules.py:90:13: E129 visually
indented line with same indent as next logical line
./manila/api/views/share_servers.py:28:9: E124 closing bracket does not
match visual indentation
./manila/api/views/share_servers.py:34:9: E124 closing bracket does not
match visual indentation
./manila/share/drivers/netapp/driver.py:336:5: E125 continuation line
with same indent as next logical line
Also fixes other pep8 warnings in these files.
Partial-Fix: #1333290
Change-Id: Ida14ea8f4716e49f7379f929971fd5e462541527
Refactored migration tests to use OpportunisticTestCase, removed
unused code, BaseMigrationTestCase class and ``test_migrations.conf``
file.
Added workaround for bug 1359982 to be able to merge this patch.
Closes-Bug: #1359888
Related-Bug: #1359982
Change-Id: Iade2bd2bf50880e167c5a5be8b1236c437f28702
Fix and enable hacking test:
H402: one line docstring needs punctuation.
Fix testsuite, the change for manila/tests/api/extensions/foxinsocks.py
needs corresponding changes.
Change-Id: I587cd6771787ca56b1410f86a6ec13380bcc206b
Fixes:
manila/scheduler/simple.py:74:45: F812 list comprehension redefines
'service' from line 59
manila/api/v1/share_networks.py:147:41: F811 redefinition of unused
'network' from line 29
Do not blacklist these tests anymore.
Partial-Bug: #1333290
Change-Id: Ibf3c170ada17a7af0708331331bc435942c3763b
Delete Manila's implementation located in tools/conf and replace
it with common config generator located in tools/config. The new config
generator include config options from other modules (olso.messaging,
oslo.db, oslo.db.concurrency) which improves the generated sample config.
Change-Id: I553e1a8ec414383e2d79d445ebd10e0e1ffa1ae4
Fix:
./manila/api/contrib/used_limits.py:45:27: F402 import 'quota' from line
19 shadowed by loop variable
Rename the loop variable.
Remove F402 from ignore list since it now passes.
Change-Id: Iaa1f882d0ce1843496283a922b701860746995a2
Instead of ignoring all flake8 specific errors ("F"), list those
codes that currently fail so that they can be addressed one by one
and the currently passing ones will not get added by accident.
Change-Id: Ia40f0d832b70eeb788ae14a84dc0c40cc2e4724f
Remove comment about H904 since H904 has been removed from hacking,
there's no need to fix it.
Remove E712 ignore since the code is clean.
Remove E711 ignore and fix the problems in manila/db/sqlalchemy/api.py to
make it pass.
Remove H304 ignore since the code is clean.
Change-Id: I4f9477a61d6f1ddde16b5ff9e387c76076c89d6e
Manila's test framework is pretty old and requires update.
Changes:
- usage of nose replaced with testr
- now all the tests are thread safe
- added new options for run_tests.sh, such as --concurrency, --debug, etc...
- new '--concurrency' option for run_tests.sh defaults to 1, examples:
./run_tests.sh # will run in 1 thread
./run_tests.sh --concurrency 2 # will run tests in 2 threads
- added tools/colorizer.py for colorizing output of testrun with run_tests.sh
- tests running with tox use as much threads as cores available by default
- examples of testrun with tox:
tox # will run test suites defined with 'envlist' in tox.ini, now it is pep8,py26,py27
tox -epy27 # amount of threads is equal to amount of cores
tox -epy27 -- --concurrency=2 # amount of threads is 2
tox -epy27 -- --concurrency=4 # amount of threads is 4
- Added 'Database' class to manila.test module, for more conveniant db testing
- updated policy file 'manila/tests/policy.json' to allow share-network actions
- removed nose-related requirements
- added new requirements for testrepository, subunit
With merge of this change all old installed virtual environments become
incompatible and should be removed with "rm -rf .tox .venv" before testrun.
Implements blueprint testr-with-unittests
Change-Id: I9579ecd538e29d478dbc12adc7dcc33fc668b397
Get requirements in sync with global requirements again.
As this updates hacking to a more recent version, add
some blacklisting of hacking warnings to tox.ini to
get the gate passing. Those will be cleaned up
in followup commits.
Change-Id: I18f956d999db21be197ce35044623eaa22ed4185
'print' function is compatible with 2.x and 3.x python versions
Partially-implements blueprint py3-compatibility
Change-Id: Idea6704be7f49778ca9e99be5b7f449cb89f39dc
This brings along Hacking requirements to match
other OpenStack projects. Since hacking already
requires the right pep8 pyflakes etc version,
those dependencies are not necessary to be specified
here.
Change-Id: Ifb575aa549bfd0288e44acda9a750ea40b9d14c2