29 Commits

Author SHA1 Message Date
Jay S Bryant
388a131c3d Remove remaining oslo-incubator code from Cinder
Most of the parts for oslo-incubator have moved to
oslo libraries.  Cinder only had imageutils.py and
_i18n.py remaining in cinder/openstack/common.  I
was to able remove both of these remaining incubator
components.

oslo_utils now has imageutils available.  I moved
cinder/image/image_utils.py to use the new
imageutils from oslo_utils and updated all the other
places that were using the old imageutils import.

_i18n was only being used in scheduler/base_filter.py
which appears to have been accidentally left when the
scheduler was previously pulled out of incubator.  I
fixed this oversight.

Finally, this patch deletes cinder/openstack/common
cinder/openstack and the openstack-common.conf file.

Change-Id: I8fe0b5d6c278715620f93f682289df7ae60dbeba
Closes-bug: 1517861
2016-03-09 10:49:18 -06:00
Eric Harney
b985bae7c4 Detect addition of executable files
When running pep8 checks, fail if executable
files have accidentally been added.

Change-Id: Ia0efa629acf794f8e0e9b78de24b5385776c1e66
2015-08-31 12:19:51 -04:00
Eric Harney
683dd65d41 Test whether sample config generation works
Adds --checkonly to tools/config/check_uptodate.sh.

This allows verifying that a configuration file was
generated.

We have had a number of issues introduced which
have caused config file generation to fail since we
removed the sample config file check in the gate.
This does not add back checks to ensure that the file
has been updated, it only checks to ensure that it is
still possible to update the sample file.

Change-Id: I2e0e376fbdec5a1bb584c6739231649e1d0f5d8e
2015-08-18 17:31:01 -04:00
Matthew Treinish
456db81765 Use subunit-trace to enable output during unit test runs
This commit adds the pretty_tox.sh script and the usage of
subunit-trace to the cinder unit test jobs. This also updates the
run_tests.sh script to use subunit-trace so it'll have consistent
output formatting with the tox job.

Change-Id: I8ceafb476dc488b388c7f63501ef48128d8383d2
2015-02-23 10:27:16 -05:00
Thang Pham
5fb266a0da Use pbr entry_points to setup the cinder scripts
The following patch changes how cinder scripts are
installed and unit tested. This patch moves all the
cinder scripts from bin into cinder/cmd and creates
entry_points for those scripts in setup.cfg. When
cinder is installed, these scripts will be installed
under /usr/local/bin by pbr.

DocImpact: 'host' config option for multiple-storage backends
in cinder.conf is renamed to 'backend_host' in order to avoid
a naming conflict with the 'host' to locate redis
Change-Id: If82cf0c58d765bf79dbf721ca95c10a468940cab
Implements: blueprint unit-test-cases-for-cinder-scripts
2014-12-08 09:53:22 -05:00
John Griffith
18a7f13d38 Remove the check_uptodate conf checks
We recently removed the checkupdate tests for sample.conf
here Ie4e25a8cd36782007a8934cc4573632f5215c2b1

To stop gating on this as it's just a big fat
pain when external libs change.

Instead, we'll start generating this in an external
job and publishing somewhere.

Funny thing though, we actually have a direct call in
run_tests.sh as well.

This patch removes the second call in run_tests.sh

Change-Id: Iaef411e254186fbba80c21903d6f94538a808d93
2014-12-04 21:05:49 -07:00
git-harry
373fad9dc5 Fix running unit tests with coverage
The path to this repo is added to PYTHONPATH when the coverage flag is
specified so that the cinder entry points are discovered.

Change-Id: Ie33a63c6ecd443b900fa7bed3a1ec5b6bb0065e6
Closes-Bug: #1364347
2014-09-02 13:04:06 +01:00
John Griffith
1098ab0f53 Provide a quick way to run flake8
"run_tests.sh -p" always checks every file for errors even though you
have probably only changed a handful. This patch adds "run_tests.sh -8"
which only checks the files that were modified in the HEAD commit or
the current working tree.

Copied from Matthew's work in Nova here:
  https://review.openstack.org/#/c/110746/15

Change-Id: I84f6a522da5352a703caa59975643043ec1911fe
Co-Authored-By: Matthew Gilliard <matthew.gilliard@gmail.com>
2014-08-18 16:37:32 -06:00
Jay S. Bryant
9550b6b6b4 Sync latest Oslo config code for i18n
This sync pulls the latest Oslo config code over
to Cinder.  This sync is needed to include a fix
to config generator which is needed as part of
the work to enabled i18n messages.  Config generator
was failing when lazy message translation was enabled.

The following changes are included with this patch. Each
patch includes the file(s) the patch touches:
-> c178e56 Add basic Python 3 tests
--> cinder/openstack/common/__init__.py
-> 12bcdb7 Remove vim header
--> cinder/openstack/common/__init__.py
-> 547ab34 Fix Copyright Headers - Rename LLC to Foundation
--> cinder/openstack/common/__init__.py
-> 44b6ea3 Import oslo.config configuration file generator
--> cinder/openstack/common/config/__init__.py
-> dd9aa2b Remove unused variables
--> cinder/openstack/common/config/generator.py
-> 5dce17b Use entry points to discover options in libraries
--> tools/config/generate_sample.sh
--> cinder/openstack/common/config/generator.py
-> e8e636c generator: add an EXTRA_LIBRARIES env variable
--> cinder/openstack/common/config/generator.py
-> e3dddd7 generator: use EXTRA_* env vars in the bash script
--> tools/config/generate_sample.sh
--> cinder/openstack/common/config/generator.py
-> 6da13e8 generator: rename EXTRA_MODULES_FILE to RC_FILE
--> tools/config/generate_sample.sh
-> 763eedf Fix DictOpt support in config sample generator
--> cinder/openstack/common/config/generator.py
-> e839886 Config generator fails with lazy messages
--> cinder/openstack/common/config/generator.py
-> 343686b Add check_uptodate to tools/config
--> tools/config/check_uptodate.sh

Oslo version:
-> 0f24d82 Fix migration.db_version when no tables
-> Date: Sat, 22 Feb 2014 00:32:18 +0000

Change-Id: I26a95fe96b08d6340b0fce1b9e2949c8e661a946
Closes-Bug: 1280826
Related-bp: i18n-messages
2014-03-06 10:07:22 -06:00
Jenkins
57d3e6e192 Merge "Don't need to init testr explicitly" 2013-09-03 09:26:17 +00:00
Kui Shi
91e2466f2d Add venv wrapper for check_uptodate.sh
tools/conf/check_uptodate.sh is added in run_tests.sh

For simple, run "run_tests.sh -p" will call it, and get following error:

Failed to collect options from module
cinder.volume.drivers.san.hp.hp_3par_common: No module named hp3parclient

Actually, the hp3parclient is listed in test-requirements.txt, and it is
installed in venv.

the check_uptodate.sh should run in venv to get correct result.

update the error message to update the cindier.conf.sample correctly.

-----------
Test method
-----------
$ pwd
/opt/stack/cinder

$ source .venv/bin/activate; tools/conf/generate_sample.sh

(.venv)$ deactivate

$ ./run_tests.sh  -p
Running flake8 ...
// no error emitted here

Fixes Bug #1219197

Change-Id: I9b3eaf3c1a5eb395eefed28bb907685cdef147aa
2013-08-31 19:39:09 +08:00
Kui Shi
059bc7a08c Don't need to init testr explicitly
In run_tests.sh, function init_testr will initialize testr if the
directory .testrepository is not existed. Actually, testr will do
the check before run the test:

In Python package testrepository, setuptools_command.py:Testr.run

68 def run(self):
69     """Set up testr repo, then run testr"""
70     if not os.path.isdir(".testrepository"):
71         self._run_testr("init")

So, init_testr can be removed safely.

Fixes Bug #1216820
Change-Id: Id9815033c0cb0e1aa6693a4c14bf9a5d490c8883
2013-08-30 15:19:38 +08:00
John Griffith
eafb7c4a2c Add automated check of conf sample
This adds check_uptodate to run_tests and
tox.ini checks.

This also requires that we add novaclient to the
test-requires, since we try and poke at cinder/compute/nova.

There is another implementation in use to do this that
pulls in openstack.common.config.generator,
(see ceilometer project for a pretty slick impl), however
adding that also pulls in a rather large list of
updates and dependencies that quite frankly Cinder
doesn't need and the ones that we do use break
a number of things in Cinder.

There's also a number of additional options added
to generate_sample that I don't think we need right now.

In the future we'll probably want to go this route
but for now I'd just like to get automated checking
in place.

Change-Id: I91aa4d98f472ad5a3ece7773c75ee76d66adafc0
2013-08-26 17:10:48 -06:00
Kui Shi
8619b974d1 emit warning while running flake8 without virtual env
run_tests.sh -N -p
it will call the flake8 installed on your host to detect PEP8, and
the flake8 plugin "OpenStack hacking" may not installed on your
host, so this command may not detect the OpenStack Style Commandment
supplied by hacking(e.g H202).

run_tests.sh -p
it will call the flake8 from virtual env, flake8 plugin "OpenStack
hacking" installed in virtual env will be triggered.

The result from "run_tests.sh -p" should be trusted, and jenkins uses
virtual env to run flake8 too.

When "-N" is enabled, emit warning to remind user.

Bug #1208584

Change-Id: Ie08e5fa2b44088dad135e11583c046650d65df1e
2013-08-21 19:07:43 +08:00
John Griffith
e940c0374d Add bin directory to flake8 when not in venv
If doing run_tests.sh -N -p we only check cinder*
This patch adds a directive to also check the files
in bin/

Change-Id: Ia68073e16067df978475db058c9c0693f35df81c
2013-08-05 13:44:30 -06:00
Michael Kerrin
930f5891b0 Fix up the test framework
When trying to test a bug the cinder test framework was
running all the tests when I just wanted one to run.

Instead of fixing this problem in nose I tried to move cinder to
testr. I copied a fair bit of code from nova to get this to work.
This way at least if some one makes an improvement to the nova
test framework cinder can improve here also.

Note that now all the tests a thread safe. Added a concurrency argument
to run_tests.sh that defaults to 1. You can specify your own level then
and take the risk of intermittent failures. Tell jenkins to use a
concurrency level of 1 to avoid failing gate jobs.

Note One of these tests is broken and I have disabled for now. There
is a bug for this here: https://bugs.launchpad.net/cinder/+bug/1173266

Note: cinder.api.openstack.FaultWrapper is deprecated and is causing
a circular import when I try and import cinder.tests.test_wsgi. This
is fixed by only importing the openstack.FaultWrapper during the
__init__ phase of the wsgi middleware.

Fixes: bug 1183434
Fixes: bug 1177924

Change-Id: I5e10b55c5b236eb81a6a3e0e9ea56af8ca4ef8e1
2013-06-14 14:02:17 +00:00
John Griffith
2be0b9c39c Hack run_tests.sh to work with single tests again.
Even though we're moving to testr and this will eventually
go away, we should maintain our ability to run and debug
individual tests until the broader change is released.

This just adds some text around the nosetests call
to get us back where we were.

Fixes bug: 1181996

Change-Id: Id0082ca8954664679430cc602425b1fadd29151b
2013-05-24 13:56:28 -06:00
Eric Harney
1f0b83e2dd Allow flake8 to run in venv
flake8 should be able to run within the venv.

Change-Id: Ife269e54947f0283adceca15af60f38688e1ee64
2013-05-20 11:33:53 -04:00
John Griffith
e136c96988 Fix up hacking ignores a bit.
Add more explicit ignores to tox.ini hacking ignores until
we have a chance to fix up the imports and docstring errors
we've been ignoring.  This should give us everything we had
in the past (ie alphabetical import checks).

Also, update run_tests.sh to call flake8 and not the hacking.py
that is no longer there.

Change-Id: I6c82e958002255fd9f527b06bf0a68d148cc681e
2013-05-14 13:18:16 -06:00
Monty Taylor
af5d4b3235 Use nose and openstack nose plugin.
It's a little silly since we're working on removing nose for testr,
but it turns out that the old test run wrapper was in use here, which was
causing all sorts of havoc.

Change-Id: Ib6e31547ec4921f91b6253a1798cb04ca6930c87
2013-03-07 14:14:08 -05:00
James E. Blair
a7ebea04d1 Exit run_tests with the result code of the test runner.
Change-Id: Ie117e258c3ce78080ab55715daa8cf14f9967ce4
2013-03-07 08:55:00 -08:00
Sean Dague
cde01d5810 allow run_tests.sh to report why it failed
the set -e was suppressing all the echo information about why
run_tests.sh was failing, which makes it quite hard to figure out
what is going on.

Change-Id: Ie210ee5b5e9ff0028a89da520580db7cd1d9f03a
2013-02-22 13:22:42 -05:00
Matthew Treinish
f06f5e1bd6 Add an update option to run_tests.sh
This commit adds an update option to run_tests.sh. This option
is used to rerun install_venv.py on an already installed venv.
This will then just update out of date packages with pip.

Change-Id: I96dc6940f536feb810d57b3316e9d712aa750d93
2013-02-15 14:14:54 -05:00
John Griffith
51418bdd5b Make pep8 checks a bit stricter.
Along with moving to pep8 1.3.3, we also want to standardize
on what we ignore. This patch get's us most of the way there
by setting the ignore list to:
N4,E125, E126, E711,E712.

Almost all changes made here are white-space/indentation changes.

The removal of Hacking N4 errors from the ignore list will
be handled in a seperate patch.

Change-Id: If45f156600485d23769449018590f60b4f69b0c5
2012-11-26 16:57:15 -07:00
Chuck Short
ceee1fdaf2 Pin pep8 1.3.3
Apart of making pep8 version standard across all openstack
projects.

Also fix tools/hacking.py so it is compliant for pep8 1.2
and beyond, taken from fbc4568 in the nova tree.

Change-Id: I801c98a01960fa113dae1b6174c1a06bb149fea3
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2012-11-20 09:10:01 -06:00
Rushi Agrawal
eedc857008 Fix run_tests.sh ambiguous usage msg and behaviour for -x option
In commit
https://github.com/openstack/cinder/commit/
50792c2ff41fdc7e73b3e3c51f4510366debfd14,
the committer wanted to add an option in run_tests.sh for generating XML
coverage report, but ended up accidentally overriding the default nose
option -x. But, the usage message still showed that using option -x will
'Stop running tests after the first error or failure'. So, I changed the
option to generate XML report to  -X (capitalized 'x'). So now both -x and
-X options are available, with different purposes.

Fixes bug 1070047

Change-Id: Ie8c30c14629d4811d6db74f3eea9cdecb1d27c8a
2012-11-03 13:01:11 +05:30
Zhiteng Huang
612b1bd955 Don't do PEP8 test for openstack-common code.
Pep8 test reports issue on openstack-common modules, which would
fail CI test. Pep8 test should skip openstack-common and assuming
they are problem-free code. Even it's not, bug/fix should go to
openstack-common first, then resync back to Cinder.  Therefore,
Cinder should skip pep8 test for openstack-common code.

Fix bug #1027774

Change-Id: I22c45542401022a6bad9f2320e8657f972915f69
2012-07-23 14:39:48 +08:00
Monty Taylor
50792c2ff4 Fix up coverage and jenkins test running.
The docs job wasn't working because of an un-renamed file.
Coverage wasn't running in jenkins with the xml output file.
Remove the .cache.bundle support that we're moving away from.

Change-Id: I1140baa53dee8b14ac4d1f8549425a0fdd7a8425
2012-05-21 16:46:25 -04:00
Jenkins
c53d8e343e Initial fork out of Nova. 2012-05-03 10:48:26 -07:00