55 Commits

Author SHA1 Message Date
Shuquan Huang
031c49461e Put py34 first in the env order of tox
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
2015-12-02 22:56:19 +08:00
Valeriy Ponomaryov
75290c5534 Add py34 to test environment to tox.ini
Manila code base was updated to work on top of python3.4
So, add its test environment to tox.ini

Change-Id: I1403b6b758de52110a53e571c81863c98e909b99
2015-08-12 12:22:31 +03:00
Valeriy Ponomaryov
4ea9031b4f Make coverage tox job fail when test coverage was reduced
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
2015-07-27 14:53:37 +03:00
Jeremy Stanley
74f09b7379 Remove unneeded OS_TEST_DBAPI_ADMIN_CONNECTION
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
2015-07-03 23:06:05 +00:00
Jeremy Stanley
1548d460b8 Override opportunistic database tests to PyMySQL
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>
2015-06-18 19:06:01 +00:00
Valeriy Ponomaryov
9d6ae07585 Remove unused contrib/ci files
Files located in contrib/ci/multi_backend are unused. So, remove it.

Change-Id: Ibe9cb2321936c3dcecbb61bc23a7c5c6d9e90bd4
2015-06-08 11:33:31 +03:00
Julia Varlamova
b6ab3167dc Use entry_points for manila scripts
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
2015-04-14 21:04:01 +03:00
Luis Pabón
72d2840048 Enable developers to see pylint output
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>
2015-04-03 15:10:18 -04:00
Thomas Bechtold
6785cad994 Enable bashate during pep8 run
bashate checks shell script syntax (similar to pep8 for python). Fix
currently available scripts and enable the check for the scripts.

Change-Id: I33dc8c44a58f40e8bca9e29cd717caf46e5cd586
2015-03-18 13:40:03 +01:00
Valeriy Ponomaryov
bcbab9ce11 Remove Python 2.6 classifier
OpenStack projects dropped support for py26 in Kilo release. So, remove its
classifier.

Change-Id: I22f18eeb9c66837475fa46b06ca4e7b5492065ef
2015-03-01 08:13:45 +00:00
Jenkins
c088dc8fad Merge "Silence tox warning" 2014-10-27 01:24:45 +00:00
Jenkins
8cc70c0d82 Merge "Switch to oslo.config" 2014-10-24 16:33:05 +00:00
Andreas Jaeger
883e02f219 Switch to oslo.config
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
2014-10-22 19:55:45 +02:00
Andreas Jaeger
9cd58e5741 Silence tox warning
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
2014-10-21 09:37:15 +02:00
Andreas Jaeger
f039a76868 Add manila specific hacking checks
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
2014-10-21 09:34:59 +02:00
Jenkins
a7128d5404 Merge "Remove extra flake8 args" 2014-10-21 03:01:38 +00:00
Andreas Jaeger
54d12cab61 Remove extra flake8 args
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
2014-10-20 08:05:07 +00:00
Andreas Jaeger
7b659fc4e0 Use oslo.i18n
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
2014-10-19 19:21:03 +02:00
Valeriy Ponomaryov
e089a1bc6f Remove hash seed dependency for unittests
latest tox has random hash seed enabled, that causes
unstable unittests errors.

Change-Id: I0e24304ca045c5347aa9fd97ee28ac3be774fa31
Closes-Bug: #1359982
2014-08-27 18:59:20 +03:00
Andreas Jaeger
2641eb9b57 Flake8: Fix and enable H405
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
2014-08-27 13:39:22 +02:00
Andreas Jaeger
1ee54a3144 Flake8: Fix H501
Fix all occurences of:
H501  Do not use locals() for string formatting

Change-Id: Id221d257975659d31b29ed696345f96525c3b459
Partial-Bug: #1333290
2014-08-27 10:47:56 +00:00
Andreas Jaeger
8203c51081 Flake8: Fix and enable H404
Fix and enable flake8 test H404:
H404  multi line docstring should start without a leading new line

Change-Id: I13dc13bb5e81d65300680df094cde538c7a6f6df
Partial-Bug: #1333290
2014-08-27 10:47:45 +00:00
Andreas Jaeger
4a49b5e562 Flake8: Fix E128
Fix and enable E128:
E128 continuation line under-indented for visual indent

Partial-Bug: #1333290

Change-Id: I72f673d291c388fc4df19e9585fb02e23c21fec3
2014-08-27 12:46:30 +02:00
Andreas Jaeger
ab96ccb1ef Flake8: Fix H302
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
2014-08-26 12:50:59 +02:00
Jenkins
e85bdaca65 Merge "Flake8: Fix F841" 2014-08-26 10:39:25 +00:00
Andreas Jaeger
e1ab0e25c7 Flake8: Fix F841
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
2014-08-25 08:58:38 +02:00
Jenkins
0886ef51d7 Merge "Remove extra setenv from tox.ini" 2014-08-25 04:20:08 +00:00
Jenkins
ac190572cc Merge "Add specific docs build option to tox" 2014-08-25 04:18:37 +00:00
Thomas Bechtold
e95762398d Add specific docs build option to tox
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
2014-08-23 20:17:09 +02:00
Andreas Jaeger
9154f3e55b Flake8: Fix E126 and E127
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
2014-08-23 08:43:02 +00:00
Andreas Jaeger
290769f087 Flake8: Fix F401
Fix:
F401 'XXX' imported but unused
Add noqa where needed, remove extra imports otherwise.

Remove F401 from ignore list.

Partial-Bug: #1333290
Change-Id: Ib71f0dd001c4e4899200b5e60b3a38e4a6c40555
2014-08-23 08:42:36 +00:00
Andreas Jaeger
2965d59541 pep8: Enable H303 and F403
Remove wildcard imports that are unneeded.
Add #noqa for needed wildcard imports.

Enable H303 and F403 flake8 tests.
Partial-Bug: #1333290

Change-Id: I5974b899bfd0ffbcc6a5dda330693c17cde91317
2014-08-23 10:40:52 +02:00
Andreas Jaeger
6214d01ad9 Remove extra setenv from tox.ini
Remove extra setenv lines that shadow the global setting in the
[testenv] section.

Change-Id: If28ba0df955192bfda53aaf6f81d2c729a51dd7c
2014-08-22 21:40:36 +02:00
Andreas Jaeger
e287c9e263 Enable E121,E122,E123,E124,E125,E129 flake8 tests
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
2014-08-22 21:31:47 +02:00
Victor Sergeyev
b081462046 Use opportunistic migrations
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
2014-08-22 12:44:33 +03:00
Andreas Jaeger
43aeceff2f Fix H402 hacking rules
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
2014-08-19 17:04:54 +02:00
Andreas Jaeger
09b1917fe8 Fix pep8 F811 and F812
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
2014-08-15 15:36:51 +02:00
Thomas Bechtold
c16feaea5e Use common config generator
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
2014-08-12 16:33:06 +02:00
Andreas Jaeger
7d61666a62 Fix F402 pep8
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
2014-08-05 15:04:06 +00:00
Andreas Jaeger
518a2491b8 Make flake8 ignore list more fine granular
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
2014-08-05 15:03:59 +00:00
Andreas Jaeger
e4911b178d Update pep8 testing
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
2014-07-28 23:09:55 +02:00
Christian Berendt
da0e39f175 Enable check for H237
* H237: module is removed in Python 3

Change-Id: If23059e8c4af05aeede2b5fb239e37bc3f595524
2014-07-25 14:10:31 +02:00
vponomaryov
16a04df3d0 Refactor test framework
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
2014-07-22 14:58:48 +03:00
Christian Berendt
799319baab Enabled hacking checks H305 and H307
* H305  imports not grouped correctly
* H307  like imports should be grouped together

Change-Id: I9dc5f995ea07d7c319d944e847a9d1c126937240
2014-07-20 18:48:31 +02:00
Christian Berendt
8c1a574de3 Enable hacking check H236
* [H236] Use six.add_metaclass instead of __metaclass__

Change-Id: I4b943ff57be26c7ca0e7161114c2ef56a6a12df8
2014-07-16 19:12:04 +02:00
Dirk Mueller
6f892ed590 Sync with global requirements
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
2014-07-14 11:15:21 +02:00
Christian Berendt
942503d8ed Enabled hacking check H403
* [H403] Multi line docstrings should end on a new line.

Change-Id: Idd2d40c6304a0f75b192dbbe88c1d81b59dfa957
2014-07-10 16:53:41 +02:00
Christian Berendt
1f3525a3dd Enabled hacking check H401
* [H401] Docstrings should not start with a space.

Change-Id: Ia128f72f8dd209c9f732e7aa7da4b2d2210d9588
2014-07-08 23:17:48 +02:00
Valeriy Ponomaryov
4c9a4808b7 Replace python print operator with print function (pep H233, py33)
'print' function is compatible with 2.x and 3.x python versions

Partially-implements blueprint py3-compatibility

Change-Id: Idea6704be7f49778ca9e99be5b7f449cb89f39dc
2014-07-02 08:56:12 -04:00
Dirk Mueller
c6383f1f16 Switch to Hacking 0.8.x
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
2014-05-23 00:36:45 +02:00