summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix Zmq so it doesn't rely on nova flagsJason Kölker2012-07-101-2/+3
| | | | | | | | | | | | | | | | | | * Embeded newlines in logging makes me cry * String formatting uses parens not curly braces * Fix LP1023039 * Hard skip Zmq tests so jenkins passes. Someone will have to fix. Change-Id: I9b12ac47b02edf1d8dba7236550deb8ee33f5e07
* | Switch common files to using jsonutils.Andrew Bogott2012-07-035-38/+39
| | | | | | | | | | | | | | | | For blueprint use-common-jsonutils Pretty much just a search and replace. Change-Id: I66f63e7b0ff82a37d8a6b9acef94f4e10a45bf90
* | Add common logging and notification.Andrew Bogott2012-06-254-0/+553
|/ | | | | | This code is migrated from Nova, and will soon replace it. Change-Id: I2dacac3ef251d419c7049154f6aaf0c18fdb9bb4
* Merge "Skip argparse when injecting requirements."Jenkins2012-06-221-8/+48
|\
| * Skip argparse when injecting requirements.Dan Prince2012-06-201-8/+48
| | | | | | | | | | | | Also adds some unit tests parse_requirements. Change-Id: I3d8625d4627c7933d73059a63f96e19f8d9647ab
* | Avoid erroneous "Unsupported RPC Version" message if method is missingDan Smith2012-06-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent RPC versioning support introduced some odd behavior if a non- existent method is called. Instead of reporting that the method does not exist (as the code used to do, in the form of an AttributeError), it now Reports "Unsupported RPC Version". This is highly confusing, as the RPC versions *do* match and is just a result of the logic used to check every advertised RPC proxy for the method. This patch notes if any of the RPC versions matched the requested one, and if so, raises an AttributeError if the method is never found, instead of UnsupportedRpcVersion. Also add unit tests for the cases where a method is missing, both when the API version matches and not. Change-Id: Icb7b13fa890000f1bd03382d5cce747e3311ef6a
* | Added a base class for unit tests.Andrew Bogott2012-06-201-0/+56
|/ | | | | | | | | This provides some basic cfg and subout infrastructure for tests. It's similar to the test base used in other OpenStack projects, so having it here should make migrating tests to common somewhat easier. Change-Id: I90775bf99313e7dd16929059132ee058287b3585
* Merge "Fix nova.rpc references in comments."Jenkins2012-06-191-7/+7
|\
| * Fix nova.rpc references in comments.Russell Bryant2012-06-131-7/+7
| | | | | | | | | | | | | | | | Part of blueprint common-rpc. Strip remaining references to 'nova.rpc' that existed in comments. Change-Id: I27885918a5e38eb730504c9e88bdda2b72b23257
* | Merge "add import_object_ns function"Jenkins2012-06-181-0/+43
|\ \
| * | add import_object_ns functionSean Dague2012-06-141-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support bp:virt-driver-cleanup, there is a desire to have shorter driver strings (i.e. libvirt.LibvirtDriver instead of nova.virt.libvirt.LibvirtDriver). One way to support this is with a new import_object variant that takes a namespace to load from. If the code fails to load the driver in the prefered namespace it will also try loading the full driver path, before throwing an exception. Change-Id: Ib97c92f38685ca89f29890f8015fc413acc744f8
* | | Merge "rpc: Update rpc_backend handling."Jenkins2012-06-181-0/+25
|\ \ \ | | |/ | |/|
| * | rpc: Update rpc_backend handling.Russell Bryant2012-06-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of blueprint common-rpc. This patch updates the rpc_backend option handling in a couple of ways. 1) Set the default based on wherever this code has been copied to. 2) If we fail to import the backend, replace 'nova.rpc' with 'nova.openstack.common.rpc' just in case the value came from an older nova configuration file. Backwards compatibility is a good thing. Change-Id: I9ad7c084a2f0813ca1559115e7612f0a24fcce67
* | | Update common code to support pep 1.3.Gary Kotton2012-06-1813-190/+219
| | | | | | | | | | | | | | | | | | bug 1014216 Change-Id: I3f8fa2e11c9d3f3d34fb20f65ce886bb9c94463d
* | | Merge "Add missing ack to impl_qpid."Jenkins2012-06-151-0/+4
|\| | | |/ |/|
| * Add missing ack to impl_qpid.Russell Bryant2012-06-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | Fix bug 1012374. Johannes Erdfelt pointed out that impl_qpid wasn't acking messages that it received. This turned out to be a nasty oversight, resulting in unbounded message queue growth inside of the python-qpid library. This fixes it. Change-Id: I446530239e16701009c4db8407a344596bb17952
* | Merge "add more realistic unit tests for importutils"Jenkins2012-06-142-0/+45
|\ \ | |/ |/|
| * add more realistic unit tests for importutilsSean Dague2012-06-122-0/+45
| | | | | | | | | | | | | | Add realistic tests including objects with and without args to importutils. Change-Id: If23db5ef80cdfa4be95e95b90e647ac2455fffc8
* | Merge "Add impl_zmq to rpc."Jenkins2012-06-121-0/+132
|\ \
| * | Add impl_zmq to rpc.Russell Bryant2012-06-111-0/+132
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of blueprint common-rpc. This driver just went into nova.rpc. Pull it in over here. I haven't been able to test this, but I can't get the tests to work in nova, either. There is a bit of a complication with impl_zmq worth mentioning. It requires a service to run (nova/bin/nova-rpc-zmq-receiver). Only once instance of this service should run on a given machine, so it shouldn't be copied into each project that uses rpc. Once openstack-common is an installed library, it can be distributed with that, but until then ... we'll just leave it in nova for now. Change-Id: I2bd067be58d943d4f3a90e013b22282217484872
* / Fix utcnow_ts to return UTC timestampZhongyue Luo2012-06-111-1/+4
|/ | | | | | | | Fixes bug #1011121 Use calendar.timegm instead of time.mktime Change-Id: Idb8d470f1ef90162641d21122699a026fa38faf1
* Merge "Add nova time util functions to timeutils"Jenkins2012-06-081-10/+54
|\
| * Add nova time util functions to timeutilsZhongyue Luo2012-06-061-10/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug #1009410 1. Add the following functions from nova/utils.py - strtime - parse_strtime - is_older_than - utcnow_ts - advance_time_delta - advance_time_seconds 2. Write unittests in tests/unit/test_timeutils.py Change-Id: Ie0bba90833e2ed31bb5ab867a7c1a76a9901cacb
* | Merge "Add support to include config aliases"Jenkins2012-06-081-1/+144
|\ \
| * | Add support to include config aliasesJoe Gordon2012-06-061-1/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements blueprint config-aliases * Supports loading deprecated aliased options from a config file * Supports using deprecated aliased CLI options * For MultiStrOpt Can use mix of name and alias Change-Id: I04678880bc8ee1f85335f5656367bd1437245c6e
* | | Handle xmlrpclib.DateTime types when serializing to JSONJohannes Erdfelt2012-06-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1010124 Convert xmlrpclib.DateTime types to datetime so they can be serialized without creating an exception. Change-Id: Ifcab69ad81d39d7f4066df5c71c6ab6734fb1fab
* | | Fix RPC tests to not use assertInJason Kölker2012-06-071-2/+2
| | | | | | | | | | | | | | | | | | * Fixes Bug #1010244 Change-Id: Idac365a1719c49846ef105b90683e631310fbf6c
* | | Merge "Fix a pep8 error."Jenkins2012-06-071-0/+1
|\ \ \
| * | | Fix a pep8 error.Russell Bryant2012-06-061-0/+1
| | | | | | | | | | | | | | | | Change-Id: Iab7e703254a354764a5667425ef887b0afc89115
* | | | Merge "Add rpc to openstack-common."Jenkins2012-06-0710-0/+1690
|\ \ \ \ | |/ / / |/| | |
| * | | Add rpc to openstack-common.Russell Bryant2012-06-0610-0/+1690
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements blueprint common-rpc. This patch imports nova.rpc to openstack-common. All of the necessary changes to the core code to make it compatible with openstack-common have been done in nova, so the only changes made here are to imports. There are more changes made to the tests, but nothing that changes the core functionality of the tests. Change-Id: I17330aa4adfd0f22c449a2376833c7fe9dfd0cf1
* / / Adds support for bol and eol spaces to ini filesVishvananda Ishaya2012-06-061-0/+9
|/ / | | | | | | | | | | | | * Fixes bug 1009639 * Adds tests Change-Id: Id00563dfcc6f143c3e86ec380d66cffc967b8c48
* / Add gettext support.Russell Bryant2012-06-061-0/+30
|/ | | | | | | | | | This patch adds gettext support for openstack-common modules. In the process of pulling in the rpc code, I didn't want to remove the usage of _() that was already in there. This allows it to stay in a way that doesn't conflict with gettext usage in the project using openstack-common. Change-Id: I9cad006f81244f0cce7b7f28659fa1daa5a4268a
* Merge "Create testutils with skip decorators."Jenkins2012-06-051-0/+43
|\
| * Create testutils with skip decorators.Russell Bryant2012-06-041-0/+43
| | | | | | | | | | | | | | | | This patch creates openstack.common.testutils which includes some decorators used to conditionally skip tests. This is needed for the rpc unit tests. Change-Id: Ic6bc8d58f7dfcd9eb3acd2749c475b9d760b9578
* | Common-ize policies.Kevin L. Mitchell2012-06-041-0/+401
|/ | | | | | | | | | | | | | | | | Both Glance and Nova make use of (almost) the same policy system, defined in glance/common/policy.py and nova/common/policy.py, respectively. They also have independent glue code (glance/api/policy.py and nova/policy.py), so that the common policy system is substantially similar. This makes policies a perfect candidate for incorporation into openstack-common, particularly given that this same code will soon be used by Quantum. This change adds the common policy module (along with some minor interface changes and bug fixes) to openstack-common, along with a test suite. Change-Id: I0022a91f16ded28f9dc6b4975ef1b6e4cc8460ac
* Fix pep8 errors.Kevin L. Mitchell2012-06-042-7/+7
| | | | | | Fixes a couple of pep8 errors that appeared due to a pep8 tool update. Change-Id: Ida70b1fb962529d3a157f44dcf2e71af773a4431
* cfg: move constructor args to __call__() argsMark McLoughlin2012-05-291-8/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to effectively use a global ConfigOpts object, you need to be able to initialize the global object with none of the information we currently require at construction. By moving those constructor args to the __call__() method, we enable the global object usage model but also make the API generally more flexible. For example, you can now reset the object and re-use it for parsing a different set of config files with the same options. There are a couple of other minor behavior changes as a result: - print_usage() and print_help() no longer works before the object has been called to parse options - registration of duplicate short options are no longer detected until the options are parsed - the --config-file and --config-dir options aren't registered until just before parsing the options since the default set of config files can be specified at that time - find_file() can't be used until after the options have been parsed, again because of the late registration of --config-file and --config-dir Finally, an unregister_opt() method is added to support the re-registeration of the --config-file and --config-dir options. Change-Id: I650d8e299e92cbc5d10da47a7ce1b73ca8066bd0
* Run pep8 on tests.Russell Bryant2012-05-161-1/+2
| | | | | | | I noticed that pep8 wasn't running on the tests. This patch fixes that, as well as a couple of pep8 errors in test_cfg. Change-Id: I4429bfe6813a2e9394efb1753cbebbadb9f23833
* Create openstack.common.jsonutils.Russell Bryant2012-05-151-0/+118
| | | | | | | | | | | | | | | | | | | | This patch creates a new module, jsonutils. It is based on some code from nova.utils that is used by nova.rpc. It is being added to openstack-common as another step toward being able to eventually move nova.rpc to openstack-common. This module provides a few things: 1) A handy function for getting an object down to something that can be JSON serialized. See to_primitive(). 2) Wrappers around loads() and dumps(). The dumps() wrapper will automatically use to_primitive() for you if needed. 3) This sets up anyjson to use the loads() and dumps() wrappers if anyjson is available. Change-Id: I41e5759360d515ed53defe69f3e8247aafbcc83a
* Remove unused imports.Russell Bryant2012-05-141-2/+0
| | | | | | This patch removes a couple of unused impots from test_utils. Change-Id: I40a2f4086e33dbcdb2eceb699c82a1350665c181
* Merge "cfg: make reset() clear defaults and overrides"Jenkins2012-05-141-0/+42
|\
| * cfg: make reset() clear defaults and overridesMark McLoughlin2012-05-121-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | Fixes bug #998396 Both Nova and Keystone need to clear the overrides on their config object between test runs. It's reasonable to expect the reset() method would do this, so let's make it so. Also add a clear() method with the old behaviour. Change-Id: I192c5bb07e81f0fb844fa2fd429dc2e7133800de
* | Tests to cover various mailmap formats.Bhuvan Arumugam2012-05-121-6/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 994957 Mailmap might include entries in different format: Full Name <email@foo.com> Full Name <email@bar.com> Firstname <email@foo.com> Firstname <email@bar.com> <email@foo.com> <email@bar.com> This commit adds a test case to parse these entries. * tests/unit/test_setup.py Remove unused imports. Import os and setup methods to verify. SetupTest: Define unique test case name. setUp(): New method to define temporary mailmap file. tearDown(): New method to remove the temporary mailmap file. test_mailmap_with_fullname(): New method to test mailmap entry with fullname. test_mailmap_with_firstname(): New method to test mailmap entry with first name only. test_mailmap_with_noname(): New method to test mailmap entry with just email addresses. Change-Id: Icc018d4b2692ce7a7de757f02d1dd49241c30a6c
* Merge "cfg: automatically create option groups"Jenkins2012-05-101-1/+11
|\
| * cfg: automatically create option groupsMark McLoughlin2012-05-101-1/+11
| | | | | | | | | | | | | | | | | | | | Implements blueprint cfg-auto-create-groups Remove the restriction that groups must be explicitly created. Often you only need a group to have a name (not e.g. a title or help string) so we can easily just auto-create groups for that case. Change-Id: I150ab3900e3aad0068b93487c8d396d21d26cfea
* | cfg: allow options to be marked as requiredMark McLoughlin2012-05-101-0/+93
|/ | | | | | | | | | | | | | Implements blueprint cfg-required-options Add a 'required' flag to option schemas: StrOpt('foo', required=True) which causes a RequiredOptError exception to be raised if the user fails to supply a value for the option on the CLI or in a config file. Change-Id: Ied7bb25f0c1582c4991d0f212f4871b9358b73fb
* Merge "Add save_and_reraise_exception()."Jenkins2012-05-021-0/+50
|\
| * Add save_and_reraise_exception().Russell Bryant2012-05-021-0/+50
| | | | | | | | | | | | | | | | | | This patch adds save_and_reraise_exception() to a new module, openstack.common.excutils. This is based on the function of the same name from nova.utils. It is used by nova.rpc, so something equivalent is needed in openstack-common before nova.rpc can be moved here. Change-Id: Icec574a081837e0f2d0548a5759d21b0352dbee6
* | Merge "Remove common.exception from common.importutils."Jenkins2012-05-021-2/+1
|\ \