summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Normalize_time() always return naive objectYunhong, Jiang2012-09-131-0/+20
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the timeutils.normalize_time() returns naive datetime object when parameter timestamp is an naive object or a non-UTC aware datetime object, and returns aware datetime object if parameter timestamp is a UTC aware datetime object. The basic problem here is that utcoffset() of None means the object is naive but a utcoffset() of zero means that the object is aware but represents UTC time. This is fragile implementation and will trigger potential issue, because aware/native datetime is not interoperatable. For example, "timeutils.utcnow() > timeutils.normalize_time(m)" will success at most time, while trigger TypeError if m is a UTC aware object. We want to normalize all objects into naive objects. Fixes bug 1048636 Change-Id: I4a09246fa8f0dd63ca54362b877aa825d9b79772 Signed-off-by: Yunhong, Jiang <yunhong.jiang@intel.com>
* / Use pep8 v1.3.3Zhongyue Luo2012-09-134-33/+58
|/ | | | | | | Fixed indents which violate pep8 1.3.3 Also added .mailmap file to coalesce commits Change-Id: Ia7a788a28e6c0fd9cb52fb7ea477cddd7d589e58
* Merge "Make projects define 'control_exchange'."Jenkins2012-09-121-4/+4
|\
| * Make projects define 'control_exchange'.Russell Bryant2012-09-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'control_exchange' option needs to have a project-specific default value. Just don't register this option and expect it to be registered by the project using this code, at least for now. ****** IMPORTANT NOTE WHEN IMPORTING THIS CHANGE ****** If you are importing this change into a project that uses rpc, you must add the control_exchange option in your code! ******************************************************* Change-Id: Ida5a8637c419e709bbf22fcad57b0f11c31bb959
* | Added a method for parsing host:port pairs.Eugene Kirpichov2012-09-111-0/+17
|/ | | | | | | | | | | | The method works correctly with ipv6. An alternative way would be to use urlparse, but urlparse only works correctly starting with Python 2.7, so to be compatible, we have to reimplement this part. The method will be used for parsing Glance API server addresses, RabbitMQ addresses and perhaps other things. Change-Id: Ie5014891c6abcd80681a370d5dd94cb0406f7f61
* Merge "Allow non-string items in the creds dict."Jenkins2012-08-311-0/+7
|\
| * Allow non-string items in the creds dict.Vishvananda Ishaya2012-08-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generic checking in policy allows us to match against data from the creds_dict using a very simple syntax. For example, in policy.json if you had something like: "some_action": [["project_id:foo"]] it would only allow project foo to perform that action, but something like: "some_action": [["is_admin:True"]] where is_admin is a boolean fails. This modifies the check to convert the value to unicode before attempting to compare it. It includes a test. Fixes bug 1039132 Change-Id: I0e53a6ea2709212d4a1536f901bcf1e717a232ca
* | Regarding the mispelling of the Noble Narwhal.Matt Joyce2012-08-221-1/+1
|/ | | | | | | | | | | | | | | | | | | | The narwhal, or narwhale, Monodon monoceros, is a medium-sized toothed whale that lives year-round in the Arctic. One of two living species of whale in the Monodontidae family, along with the beluga whale, narwhal males are distinguished by a long, straight, helical tusk, actually an elongated upper left canine. Found primarily in Canadian Arctic and Greenlandic waters, rarely south of 65°N latitude, the narwhal is a uniquely specialized Arctic predator. In the winter, it feeds on benthic prey, mostly flatfish, at depths of up to 1500 m under dense pack ice. Narwhals have been harvested for over a thousand years by Inuit people in northern Canada and Greenland for meat and ivory, and a regulated subsistence hunt continues to this day. While populations appear stable, the narwhal has been deemed particularly vulnerable to climate change due to a narrow geographical range and specialized diet. Via Wikipedia Change-Id: I0aa6fb9a29f6e851eb2621d70d400e1505ae2d32
* Merge "Remove amqp import from rpc/test_common"Jenkins2012-08-201-1/+0
|\
| * Remove amqp import from rpc/test_commonEric Windisch2012-08-141-1/+0
| | | | | | | | | | | | This import is no longer used. Change-Id: I4683a5b173fecc345b27c43b6cace39b4b491e8b
* | Add threadgroup to manage timers and greenthreads.Angus Salkeld2012-08-201-1/+11
| | | | | | | | | | | | | | Part of blueprint service-infrastructure Change-Id: I40593b6ad13d99d9e63c8c04154a0dac5aced02e Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* | Add basic periodic task infrastructure.Angus Salkeld2012-08-201-0/+71
| | | | | | | | | | | | | | | | | | | | So the idea is Manager will inherit from PeriodTasks and create a timer to call run_periodic_tasks(). Part of blueprint service-infrastructure Signed-off-by: Angus Salkeld <asalkeld@redhat.com> Change-Id: I822b8501ad184d0e5885cada1a3d7a847e2ca12c
* | Add multiprocess service launcherAngus Salkeld2012-08-201-1/+136
| | | | | | | | | | | | | | Part of blueprint service-infrastructure Signed-off-by: Angus Salkeld <asalkeld@redhat.com> Change-Id: I848e8c91d2c331e5c78a176258318457a9041131
* | Basic service launching infrastructureAngus Salkeld2012-08-151-0/+40
|/ | | | | | | Part of blueprint service-infrastructure Change-Id: I4e97db2877be976b0c681da9ff0d331fbfb306b0 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* Merge "Allow set_default and set_override to use None"Jenkins2012-08-131-2/+29
|\
| * Allow set_default and set_override to use NoneVishvananda Ishaya2012-08-111-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation interprets set_default('foo', None) and set_override('foo', None) as 'clear the existing default or override', which makes it impossible to override a value with None. This patch adds support for overriding with a None value by adding a special internal class. set_override('foo', None) will now override the existing value with None. This is a slight change to the existing behavior, so this patch adds two calls for the old functionality of clearing defaults and overrides. Example syntax for the new calls are shown below: conf.clear_default('foo') conf.clear_override('foo') The patch also updates the tests to reflect the change in functionality and adds new tests to verify the new functionality. Fixes bug 1035478 Change-Id: Iee5e20e44da9bef6b86e0483ab0b48b625fe503c
* | Tilde expansion for --config-file and --config-dirMark McLoughlin2012-08-111-0/+40
|/ | | | | | | | | Fixes bug #1012671 Allow a filename starting with ~ or ~user to be passed for --config-file or --config-dir. Change-Id: I67705401ed1c35c0cc2161095e36616552740aba
* Merge "Make receiver spawning in impl_zmq more robust/clean."Jenkins2012-08-101-19/+26
|\
| * Make receiver spawning in impl_zmq more robust/clean.Eric Windisch2012-08-011-19/+26
| | | | | | | | | | | | | | | | | | | | The receiver spawning had some faulty and complex logic which this patch improves. The old logic was logging detection of a zmq-receiver socket, although the code was also launching a receiver daemon. It was also doing dirty things such as intentionally doing a return to trigger a finally block. Change-Id: Ic044710679c43753240a2b9d909088af5317cbf4
* | Support for marshalling datetime while preserving microseconds.SandyWalsh2012-08-101-0/+6
| | | | | | | | | | | | Needed for performance measurement via "inflight" service. Change-Id: I5c1a8395b4cbc5fc0f8649b3af8130f45dd401bb
* | Merge "Add import_opt() method to ConfigOpts"Jenkins2012-08-104-0/+83
|\ \
| * | Add import_opt() method to ConfigOptsMark McLoughlin2012-07-314-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to blueprint cfg-global-object When using the global config object pattern, you often have modules which define options that are referenced in other options. So, for example if module A defined option 'foo' and module be needed to reference that option, you might do: import A print CONF.foo However, this makes it entirely unclear to the casual reader why module A was imported. Nova has a flags.DECLARE() function that helps with this problem by allowing you to do: flags.DECLARE('foo', 'A') The function simply imports module A and checks that the 'foo' option is now defined in the global config object. This is fine, but it is also implicit that this function applies to the global config object. Instead, let's do the following: CONF.import_opt('foo', 'A') Change-Id: I7b98f5be71068bbde70cc0eab991eaebb577de52
* | | Merge "Fix meaningless test case"Jenkins2012-08-061-1/+1
|\ \ \
| * | | Fix meaningless test caseMate Lakat2012-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to fixing bug 1031351 The testcase was meaningless. Change-Id: I7b88b86a600fac0c30bcac354262ac00593b495c
* | | | Add multiple-driver support to the notifier api.Andrew Bogott2012-08-025-189/+104
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move all of the functionality previously provided by the list_notifier into the basic notifier api. Move and restructure tests accordingly. Remove the list_notifier file and test file. For bug 1025820 Change-Id: Idf7cb975dd78e9951188781622a4d10ca466b154
* | | Merge "Install a qualified except hook."Jenkins2012-08-021-0/+27
|\ \ \
| * | | Install a qualified except hook.Mate Lakat2012-08-011-0/+27
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1031351. As an Exception is raised, it was not visible in the log, because it wasn't qualified. The fix sets up the exception hook to be qualified as the product_name. Change-Id: Ie8061d003b05ea8b00db5d8ed8fa445ccc822942
* | | Merge "Use function registration for policy checks"Jenkins2012-08-011-56/+113
|\ \ \
| * | | Use function registration for policy checksKevin L. Mitchell2012-07-301-56/+113
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original policy framework allowed new policy checks to be created through inheritance. This is somewhat clunky and unnecessary in Python. This change refactors policy.py to allow new policy checks to be registered using an @register() decorator. One consequence is that HttpBrain is deprecated. Care has been taken to ensure backwards compatibility; deprecation warnings will be emitted for uses of HttpBrain or the inheritance- based checks. Change-Id: I3ccef5868906ef64a3c24d6c92533471e89682ba
* | | Reduce test_zmq's reponse timeout.Eric Windisch2012-08-011-0/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | The rpc response timeout in Nova's fake_flags.py was 5 seconds. This was lost in the transition to openstack-common, is no longer set globally. As in test_kombu.py, this should be set in test_zmq.py The default value is much higher than it needs to be for the purposes of testing. A lower value fails faster, resulting in faster tests in the event of failures. Change-Id: I106919d36acd19b702be85e453e949495db70ea9
* | Merge "Copy LoopingCall from nova for service.py"Jenkins2012-07-311-0/+52
|\ \
| * | Copy LoopingCall from nova for service.pyAngus Salkeld2012-07-311-0/+52
| |/ | | | | | | | | Change-Id: Ib6683324f92345c17cfd7234d08070b48ffb4d3e Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
* | Merge "Remove unnecessary register_opts from test_zmq"Jenkins2012-07-311-2/+0
|\ \ | |/ |/|
| * Remove unnecessary register_opts from test_zmqEric Windisch2012-07-251-2/+0
| | | | | | | | | | | | | | The calls to register_opts are no longer required, and are no longer called from the tests of other rpc mechanisms. Change-Id: I40fe63d43aad8fcf37d5332a1aa05e2b3068f01a
* | Merge "don't throw exceptions if %(color)s tag is used"Jenkins2012-07-301-0/+54
|\ \
| * | don't throw exceptions if %(color)s tag is usedSean Dague2012-07-271-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixed bug #1030078 If the log format strings include the %(color)s key in them and you enable file logging, your log files won't work, and instead you'll see exceptions on the console as the default python log handler doesn't support that keyword. This approach stubs out the extra keywords to be empty strings to avoid the KeyError. Tests are also added to demonstrate the KeyError as defined behavior, and test that color codes can be passed. Change-Id: Ia5dbaee9c530e243e2121667c8a54e6f9d66e1e7
* | | Merge "Use BaseTestCase for all tests which override config"Jenkins2012-07-304-38/+19
|\ \ \ | |/ / |/| |
| * | Use BaseTestCase for all tests which override configMark McLoughlin2012-07-204-38/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug #1027120 We already have nice helper methods for overriding config and cleaning up the overrides, so let's use them. Change-Id: Ibd501743d1c4ec21cb2b0d22382cb681ee5768ed
* | | Modifies _is_opt_registered fcn to check for duplicate optsGiampaolo Lauria2012-07-241-6/+2
| |/ |/| | | | | | | | | | | | | | | | | This change fixes bug 999307 Currently, the check for duplicate options is done by checking whether they are the same object. The proposed fix is to check whether all the object fields have the same value. Change-Id: I2b72d630a0c8821df1d81e25d316d8d9195be492
* | Merge changes I536e1ca0,Ifb878368,Ie1d71b85Jenkins2012-07-231-10/+21
|\ \ | | | | | | | | | | | | | | | | | | * changes: Add missing convert_instances arg. Track to_primitive() depth after iteritems(). Update iteritems test case to actually test iteritems.
| * | Track to_primitive() depth after iteritems().Russell Bryant2012-07-181-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change jsonutils.to_primitive() to increase the recursion depth counter when calling to_primitive() on the result of iteritems() from the current element. Previously, the only time the counter was increased was when converting the __dict__ from an object. The iteritems() case risks cycles, as well. I hit a problem with this when trying to call to_primitive on an instance of nova.db.sqlalchemy.models.Instance. An Instance includes a reference to InstanceInfoCache, which has a reference back to the Instance. Without this change, to_primitive() would raise an exception for an Instance due to excessive recursion. Related to nova blueprint no-db-messaging. Change-Id: Ifb878368d97e92ab6c361a4dd5f5ab2e68fc16e2
| * | Update iteritems test case to actually test iteritems.Russell Bryant2012-07-181-11/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | This patch updates the jsonutils.to_primitive() test case for when an object has an iteritems() method. The previous implementation was mostly a copy of another test and didn't actually test calling iteritems() at all. Now it does. This is used by NovaBase in nova.db.sqlalchemy.models. Related to nova blueprint no-db-messaging. Change-Id: Ie1d71b859219392ab35b82dd3c7932b30e759c89
* / Make test_zmq bind/send to 127.0.0.1Eric Windisch2012-07-201-0/+3
|/ | | | | | | | | | | | | | By default, the impl_zmq driver binds to '*' (0.0.0.0); For the purposes of testing, we only need to bind to 127.0.0.1. Binding to all interfaces could be potentially dangerous, may simply not work in some environments, etc. In particular, we do not want our Jenkins slaves to be listening on public interfaces. rpc_zmq_host is set to 127.0.0.1 as well, which avoids hostname resolution. Normally, rpc_zmq_host is set to socket.hostname, which normally should resolve to localhost, but we do not want to test that here. Change-Id: I1224799bb399ceaf79088dd622be4b6823f29a41
* fix bug lp:1019348,update openstack-common to support pep8 1.3.Yaguang Tang2012-07-186-47/+47
| | | | | | also,this patch turns off pep8 E125 check. Change-Id: I22d2a94d89530586d614af39af17ae542c5e0cbf
* cfg: allow empty config valuesMark McLoughlin2012-07-171-0/+5
| | | | | | | | | | | | | | Fixes bug #1025522 Commit 83044a7 caused this to stop working in Quantum: api_extensions_path = and could only be worked around with: api_extensions_path = "" Change-Id: I8c1a57225a2c135e6baf567b8e71d61e974da4e2
* Don't switch to list_notifier unless necessary.Andrew Bogott2012-07-151-8/+16
| | | | | | | | | | | Some notification tests depend on a different, single notifier being used. So, don't switch to the list notifier just because we loaded this class; only switch if an actual plugin needs it. Also: improved the test that makes sure all this notifier-switching doesn't break the notifier that was present in the first place. Change-Id: I170477bccb3ad9505fe6dbfbc214f77c09f6862f
* Use strtime() in to_primitive() for datetime objs.Russell Bryant2012-07-162-3/+9
| | | | | | | | | | | This patch updates jsonutils.to_primitive() to use timeutils.strtime() to convert a datimetime object to a string instead of just using str(). This ensures that we can easily convert the string back to a datetime using timeutils.parse_strtime(). Required for the nova blueprint no-db-messaging. Change-Id: I725b333695930e12e2832378102514326fec639c
* Merge "Add 'filedecoder' method to the jsonutils wrapper module."Jenkins2012-07-111-0/+5
|\
| * Add 'filedecoder' method to the jsonutils wrapper module.Tim Daly Jr2012-06-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | Fixes bug #1017765 After version 3.3.2, the anyjson library will throw a KeyError if filedecoder isn't present. The filedecoder is just like the decoder except it takes a file instead of a string, like json.load() instead of json.loads(). Change-Id: I7bd012a7b4afa9b1ec987c3e6393cc922b5dadff
* | Add common plugin framework.Andrew Bogott2012-07-083-0/+251
| | | | | | | | | | | | | | | | | | | | For blueprint novaplugins. It turns out that most of the plugin framework applies equally well to other projects, so it's going into Nova via common so that other projects can pull it in with a minimum of fuss. Change-Id: Ia4455a8ca0b8c1c3e4b0b9647e8cacaf0a47c914