Commit Graph

48 Commits

Author SHA1 Message Date
Sean Dague 89cd6a0c49 move all tests to nova/tests/unit
As part of the split of functional and unit tests we need to isolate
the unit tests into a separate directory for having multiple test
targets in a sane way.

Part of bp:functional-tests-for-nova

Change-Id: Id42ba373c1bda6a312b673ab2b489ca56da8c628
2014-11-12 15:31:08 -05:00
Davanum Srinivas 365aae94cc docs - Prevent eventlet exception during docs generation
build_sphinx has a lot of spurious tracebacks, We don't
really need this check for document generation

Change-Id: Id9442c5902918592c4c242cc66975062cf9f2461
2014-08-01 15:43:03 +00:00
liu-sheng 74f953a1d7 Remove vi modelines
We don't need to have the vi modelines in each source file,
it can be set in a user's vimrc if required.

Also a check is added to hacking to detect if they are re-added.

Change-Id: I347307a5145b2760c69085b6ca850d6a9137ffc6
Closes-Bug: #1229324
2014-02-03 14:19:44 +00:00
Alex Gaynor cd9d8e45c6 Remove the monkey patching of _ into the builtins
Previous _ was monkey patched into builtins whenever
certain modules were imported. This removes that and
simply imports it when it is needed.

Change-Id: I0af2c6d8a230e94440d655d13cab9107ac20d13c
2013-07-26 07:31:17 -07:00
Joe Gordon efe1957237 Fix and gate on E125
E125 continuation line does not distinguish itself from next logical
line.

E125 makes code more readable, and fixing all the existing issues allows
us to gate on this, making this one less thing reviewers have to check
for.

Fix was made using https://github.com/hhatto/autopep8

Change-Id: Ie569fd74fb84d220ceb87e37b1b1f39143bba80f
2013-07-04 08:49:45 +02:00
Michael Still f2e49ad312 Import eventlet in __init__.py
All of this is because if dnspython is present in your environment then
eventlet monkeypatches socket.getaddrinfo() with an implementation
which doesn't work for IPv6. To turn this off you need to set an
environment variable before you do the import.

Resolves bug 1164822.

Change-Id: I2382db7b3ac4a2d940e0c45dfe3d48f499de2f16
2013-04-09 08:48:47 +10:00
Monty Taylor 529194e4e7 Move global fixture setup into nova/test.py
There are global fixtures that get set up for testing in
nova/tests/__init__.py, even though there is a base test class. As we move
towards parallel testing, we want to convert all of these into proper fixtures.
As a step towards that, move them into nova/test.py so that it's clear that
they are part of the global test setup. From there we'll move them into
proper fixture classes.

Part of blueprint grizzly-testtools

Change-Id: Ia0b0ae380069a212bc20e009d1088c2bad7d9177
2012-11-22 11:23:11 -08:00
Mark McLoughlin f324af2401 Move sql options to nova.db.sqlalchemy.session
With a few minor exceptions, the sql config options are used solely
within the nova.db.sqlalchemy.session module so it makes sense to move
their declaration into that module.

Change-Id: Iea9c2bb000cd713b01750ab3e796132ebeaa4ca8
2012-11-21 12:15:20 +00:00
Mark McLoughlin e237c86446 Use CONF.import_opt() for nova.config opts
The only reason for importing nova.config now is where one of the
options defined in that file is needed. Rather than importing
nova.config using an import statement, use CONF.import_opt() so
that it is clear which option we actually require.

In future, we will move many options out of nova.config so many
of these import_opt() calls will either go away or cause a module
other than nova.config to be imported.

Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
2012-11-20 00:04:49 +00:00
Mark McLoughlin 94d87bce21 Remove nova.config.CONF
Modules import nova.config for two reasons right now - firstly, to
reference nova.config.CONF and, secondly, if they use one of the
options defined in nova.config.

Often modules import nova.openstack.common.cfg and nova.config
which is a bit pointless since they could just use cfg.CONF if
they just want to nova.config in order to reference CONF.

Let's just use cfg.CONF everywhere and we can explicitly state
where we actually require options defined in nova.config.

Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
2012-11-20 00:00:21 +00:00
Mark McLoughlin 6e92a67fc3 Remove nova.flags
Now that options have all moved from nova.flags to nova.config, we can
safely remove the nova.flags imports and replace them with nova.config
imports.

Change-Id: Ic077a72dd6419bbf1e1babe71acfa43c4e8b55c8
2012-11-17 16:30:03 +00:00
Mark McLoughlin f0cd357d96 Switch from FLAGS to CONF in tests
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ic0168188dfe214fc81af04c8a9644d2d9f31600d
2012-11-10 10:21:41 +01:00
Joe Gordon 771458f724 Remove outdated moduleauthor tags
The moduelauthor tags are used by the docs to see who wrote what.
But many of them are outdated and wrong.

fixes bug 1044578

Change-Id: I9cc27430c906d1418faf28e1b53f6306c62e8f98
2012-10-01 15:25:47 -07:00
Dan Prince 3356d55977 Update reset_db to call setup if _DB is None.
This resolves issues when running individual tests that require
a database. With this fix I can once again run individual test
modules that make use of the database. For example:

  ./run_tests.sh test_libvirt

Previously this would fail with database errors.

Fixes LP Bug #1032738.

Change-Id: Icce7ac9414f0e19eece44819a217634947de7f73
2012-08-03 13:09:52 -04:00
Andrew Bogott d335457f48 Switch to common logging.
I only just moved logging from nova to common, so behavior should remain the same.

Change-Id: I1d7304ca200f9d024bb7244d25be2f9a670318fb
2012-07-02 15:57:09 -05:00
Johannes Erdfelt 46c1b6eaee Add multi-process support for API services
Implements blueprint multi-process-api-service

This is based on Huang Zhiteng's patch.

This patch adds support for running services as multiple processes. This
is primarily intended to be used with the API service as a way to provide
more concurrency than eventlet can sometimes provide.

A SIGTERM or SIGINT signal will cause the parent process to gracefully
terminate the child processes, allowing them to finish processing the
requests currently being processed. The parent will wait for the
children to finish before exiting.

Change-Id: Ie6d6802626eb42d5e64c4167be363fbf6cea2a1b
2012-06-28 19:57:37 +00:00
Zhongyue Luo c547b7161a Imports cleanup
Fixes bug #1013770

1. Reorder imports by full module path
2. Insert two blank lines after the last import

Change-Id: I294ac3ab528f17a72811392d1732158e9487f3bf
2012-06-19 01:05:37 +08:00
Monty Taylor cf34a60157 Finalize tox config.
Shrink tox.ini to the new short version.
Fix the test cases to be able to be run in nosetets plus the
openstack.nose_plugin, which finally removes the need for
nova/testing/runner.py
Also, now we'll just output directly to stdout, which will
make nose collect the trace logging directly and either output
it at the end of the run, or inject it into the xunit output
appropriately.

Change-Id: I1456e18a11a840145492038108bdfe812c8230d1
2012-06-07 12:15:42 -04:00
Russell Bryant fd49b0ec89 Use openstack.common.cfg.CONF.
Part of blueprint common-rpc.

This patch makes the rpc code use the global config object from
openstack-common.  Based on some recent discussions on the mailing list,
this may not be the final way configuration handling is done here, but
it is certainly better than the register_opts() hack that is removed by
this patch.

Change-Id: Id128126e0bc064a2a1c710c6bd32fb3d137dc7f6
2012-06-04 16:41:51 -04:00
Mark McLoughlin b858108331 Use cfg's new behavior of reset() clearing overrides
Change-Id: Ia363ab3c3c16d4988c2e7f3a73302134698a9b79
2012-05-21 21:19:57 +01:00
Dan Prince 90f305c399 Register fake flags with rpc init function.
Fixes LP Bug #994775.

Change-Id: I60b6d9b500a9a1dd801919a3b63dc3ddfa291c13
2012-05-04 15:28:49 -04:00
Dan Prince ee2f6f1bed Compact pre-Folsom database migrations.
Compacts the pre-Folsom database migrations into
a single migration (082_essex.py).

Pre-Folsom users will need to upgrade to Essex before
running any Folsom migrations.

Implements blueprint db-migration-cleanup.

Testing notes available at:

http://wiki.openstack.org/database_migration_testing

Change-Id: I64c06a3adcf83d6d723c4c11001544ba97668413
2012-05-02 21:58:09 -04:00
Russell Bryant 0b11668e64 Refactor nova.rpc config handling.
This patch does a couple of things:

1) Remove the dependency of nova.rpc on nova.flags.  This is a step
toward decoupling nova.rpc from the rest of nova so that it can be moved
to openstack-common.

2) Refactor nova.rpc so that a configuration object is passed around as
needed instead of depending on nova.flags.FLAGS.

This was done by avoiding changing the nova.rpc API as much as possible
so that existing usage of nova.rpc would not have to be touched.  So,
instead, a config object gets registered, cached, and then passed into
the rpc implementations as needed.  Getting rid of this global config
reference in nova.rpc will require changing the public API and I wanted
to avoid doing that until there was a better reason than this.

Change-Id: I9a7fa67bd12ced877c83e48e31f5ef7263be6815
2012-04-25 17:04:30 -04:00
Hengqing Hu 155ef7daab Make sqlite in-memory-db usable to unittest
Move migrate monkey patch from nova.tests.test_migrations to
nova.db.sqlalchemy.migration

Change-Id: I018e44903558cad6311fd368787583322f962d0c
2012-03-17 14:38:29 +08:00
Thierry Carrez 94ac2c4747 Avoid weird test error when mox is missing
Fail early if you can't import mox, rather than return
a cryptic and undecipherable error. Fixes bug 810424.

Change-Id: Ie56d3e7447bbba841fdc882cb1f8f70e234812ef
2012-02-02 17:29:05 +01:00
Vishvananda Ishaya e6073532e5 Separate metadata api into its own service
part 1 of blueprint separate-nova-metadata

 * adds api/metadata/ and moves code from ec2
 * moves metadata into separate binary
 * changes metadata forward to use metadata host and port
 * moves the metadata accept rule to the metadata api
 * adds nova-api-* to setup.py

Change-Id: I7f5d8e6cafc55b5c383cd88991f29c6059fb8d82
2011-11-15 13:27:58 -08:00
Brad Hall 38172d5587 Add DHCP support to the QuantumManager and break apart dhcp/gateway
This introduces a new flag "quantum_use_dhcp=<boolean>" which indicates whether
or not to enable dhcp for all of the networks.  If it is set then we start
dnsmasq (and provide it with the IP/MACs from Melange) similar to how this was
done in linux_net before.

Prior to this if you enabled dhcp then you would also get a gateway device..
some people may not want that so we now require that you specify the gateway
when creating the network in order to end up with a device that will act as a
gateway.  If you're using Melange IPAM and you don't specify the gateway you
still end up with one because it doesn't allow you to not have one.  This lays
the groundwork for the option of not having one in the future, at least :)

Also, fix quantum/melange ipam interaction

We now query for the subnets by net_id/vif_id instead of searching through all
the blocks to find the right one.  Both of the allocate and deallocate for
instance calls are now using the vif_id -> network_id mapping instead of
searching the quantum networks.  get_port_by_attachment was also changed to
take a net_id so that we don't have to search through all of the quantum
networks to find the corresponding port.

Change-Id: I6a84da35237b6c5f5cdee91ada92642103439a97
2011-11-04 20:11:53 -07:00
Jason Koelker e925958965 pass in the right argument 2011-07-22 17:01:35 -05:00
Jason Koelker 848de98876 allow 2 dns servers to be specified on network create 2011-07-21 12:45:53 -05:00
Vishvananda Ishaya 4858a276a4 fix tests 2011-07-08 18:58:24 -07:00
Vishvananda Ishaya 77b655cd16 update tests 2011-07-05 17:01:19 -07:00
Trey Morris 772a2ce2b9 merged trunk, fixed the floating_ip fixed_ip exception stupidity 2011-06-29 12:58:10 -05:00
Vishvananda Ishaya 9978d656d2 only create the db if it doesn't exist, add an option -r to run_tests.py to delete it 2011-06-25 17:26:38 -07:00
Trey Morris a442e9d3fb forgot a comma 2011-06-10 15:01:58 -05:00
Trey Morris b425aa0c49 misc argument alterations 2011-06-10 14:57:02 -05:00
Jason Kölker 36c9396757 pep8 fixes 2011-05-31 11:46:06 -05:00
Cerberus 924d7a88aa Virt tests passing while assuming the old style single nics 2011-05-26 16:30:47 -05:00
Jason Kölker 262fe4bab6 port the current create_networks over to the new network scheme 2011-05-23 13:51:53 -05:00
Vishvananda Ishaya 19dc13131b move the deletion of the db into fixtures 2011-02-23 12:00:02 -08:00
Vishvananda Ishaya 3c09d486f8 use flags for sqlite db names and fix flags in dhcpbridge 2011-02-23 11:20:52 -08:00
Vishvananda Ishaya 3b2a8b516f speed up network tests 2011-02-23 01:52:07 -08:00
Vishvananda Ishaya 2bec58e35a move db creation into fixtures and clean db for each test 2011-02-23 01:13:41 -08:00
Andy Smith 7f352a7233 move db sync into nosetests package-level fixtures so that the existing nosetests attempt in hudson will pass 2011-01-18 17:32:54 -08:00
jaypipes@gmail.com a6645d8a43 Initial i18n commit for endpoints. All endpoints must install
gettext, which injects the _ function into the builtins.
2010-12-11 15:10:24 -05:00
Todd Willey c88d1f033b update copyrights 2010-07-15 01:28:51 -04:00
Vishvananda Ishaya 4ba6802ae5 Removed trailing whitespace from header 2010-06-23 23:15:06 -07:00
Devin Carlen caeece6e37 Updated licenses 2010-06-23 22:04:16 -07:00
Jesse Andrews bf6e6e718c initial commit 2010-05-27 23:05:26 -07:00