summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Decode / Encode string utils for openstackFlaper Fesp2013-02-251-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently some clients lack of non-ASCII characters support. This patch introduces 2 functions (strutils.py) that will help clients and servers to "safely" encode and decode strings. About the ensure_(str|unicode) functions: They both try to use first the encoding used in stdin (or python's default encoding if that's None) and fallback to utf-8 if those encodings fail to decode a given text. Neither of them will try to encode / decode non-basestring objects and will raise a TypeError if one is passed. Use case: This is currently being used in glanceclient. I5c3ea93a716edfe284d19f6291d4e36028f91eb2 Needed For: * Bug 1061156 * Bug 1130572 Change-Id: I78960dfdb6159fd600a6f5e5551ab5d5a3366ab5
* | | | Merge "Clean up sqlalchemy exception code"Jenkins2013-02-251-10/+3
|\ \ \ \
| * | | | Clean up sqlalchemy exception codeChris Behrens2013-02-221-10/+3
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moves DB exceptions that can be shared between DB implementations into their own module. Adds DBDeadlock() exception wrapping. Nova has its own code for determining Deadlock and it's better to consolidate it with DBDuplicateKey checking. Change-Id: I108bd0da2a14d62e460a997b1472f0b65bfc9b95
* / | | AMQP: skip duplicate messagesKei Masumoto2013-02-221-0/+32
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using rabbit's mirrored queues or qpid's replicated queues, there are conditions under which you can receive the same message twice. One such condition is where a message has been sent to a consumer but before an ack is received by a consumer, the master fails over to a slave and the slave resends the message. Note that the consumer may have sent the ack, but it was lost as the master went down. Dispatching the same message twice is obviously something we want to avoid. In order to do so, we add a unique_id to each message sent and have consumers maintain a fixed length queue of recently seen unique message IDs. Before dispatching any received message, the queue is checked and the message is skipped if it is a duplicate. Fixes bugs 1107064. Change-Id: I5bfacadbdf7de8b34d6370b9aa869c271957692d
* | | Revert "Implement replay detection."Mark McLoughlin2013-02-202-37/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts Ib0260a0c62e3d312d2e3448a125bed64d861319e (commit a603678) The issue we're trying to fix here is bug #1107064 - when using mirrored queues with AMQP, acks can be lost while a master is failing over to a slace causing the new slave to re-send messages which had previously been acked. The "replay detection" code applies to more than just amqp and also has the appearance of a security measure (e.g. the use of the term 'nonce') when clearly it serves no security purpose until we actually have message signing. Revert the "replay detection" approach in favour of the more targetted amqp bugfix. Change-Id: I8b8d15835c8b4c85cd388f5df08b60ff4c74e38d
* | | Merge "Move DB thread pooling to DB API loader"Jenkins2013-02-202-40/+87
|\ \ \ | |/ / |/| |
| * | Move DB thread pooling to DB API loaderChris Behrens2013-02-182-40/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1128605 The dbpool code in sqlalchemy session is the wrong place to implement thread pooling as it wraps each individual SQL call to run in its own thread. When combined with SQL server locking, all threads can be eaten waiting on locks with none available to run a 'COMMIT'. The correct place to do thread pooling is around each DB API call. This patch removes dbpool from sqlalchemy and creates a common DB API loader for all openstack projects which implements the following configuration options: db_backend: Full path to DB API backend module (or a known short name if a project chooses to implement a mapping) dbapi_use_tpool: True or False whether to use thread pooling around all DB API calls. DB backend modules must implement a 'get_backend()' method. Example usage for nova/db/api.py would be: """ from nova.openstack.common.db import api as db_api _KNOWN_BACKENDS = {'sqlalchemy': 'nova.db.sqlalchemy.api'} IMPL = db_api.DBAPI(backend_mapping=_KNOWN_BACKENDS) """ NOTE: Enabling thread pooling will be broken until this issue is resolved in eventlet _OR_ until we modify our eventlet.monkey_patch() calls to include 'thread=False': https://bitbucket.org/eventlet/eventlet/issue/137/ Change-Id: Idf14563ea07cf8ccf2a77b3f53659d8528927fc7
* | | Fix IPC direct topic routing.Eric Windisch2013-02-192-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Direct messages were being stripped of the host value when performing IPC forwarding. This caused direct topics to be round-robined to all services running on the system consuming from the same base topic name. i.e. if 'scheduler.host1' and 'scheduler.host2' were running on the SAME machine, messages to 'scheduler.host1' may have been routed to 'scheduler.host2'. Now, mulitple processing specifying different rpc_zmq_host parameters will consume on separate direct topics and will not round-robin to other processes. Adds a zmq-specific test to ensure that messages to directed topics are not consumed by other consumers of direct topics sharing a bare topic on the same host. Fixes bug 1123715 Change-Id: I939c24397e58492fc16561666aed3ca891325e9c
* | | Merge "Implement replay detection."Jenkins2013-02-202-3/+37
|\ \ \
| * | | Implement replay detection.Eric Windisch2013-02-192-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | Bumps the envelope revision to 2.1 Change-Id: Ib0260a0c62e3d312d2e3448a125bed64d861319e
* | | | Support RPC envelopes in impl_zmqEric Windisch2013-02-191-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch began as a set of tests verifying the functionality of sending and receiving RPC envelopes when using impl_zmq. It was discovered that when enabled, RPC envelopes were not actually working, The ZeroMQ driver includes its own envelopes. This patch introduce versioning to that envelope, eliminating the previously reserved 'style' field. A new iteration of the zeromq-envelope is introduced, 'impl_zmq_v2'. It specifies that the zeromq-envelope should be followed by an unpacked array representing key value pairs of the standard RPC Envelope. Because the key-values of the RPC Envelope can be successfully transformed with bytes(), this prevents the need to double-serialize the content traversing the message bus. Also removes some unused imports. Closes bug 1123709 Closes bug 1055446 Change-Id: Ib04e3d092c9596146f1048d3502ac248496d313b
* | | | Merge "Add ConfigFilter wrapper class"Jenkins2013-02-194-0/+182
|\ \ \ \ | |/ / / |/| | |
| * | | Add ConfigFilter wrapper classMark McLoughlin2013-02-184-0/+182
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements blueprint cfg-filter-view At the moment, if a module requires a configuration option from another module, we do: CONF.import_opt('source.module', 'option_name') but, in fact, all options from the imported module are available for use. The new ConfigFilter class makes it possible to enforce which options are available within a module e.g. with CONF = cfgfilter.ConfigFilter(cfg.CONF) CONF.import_opt('foo', 'source.module') CONF.register_opt(StrOpt('bar')) then the foo and bar options would be the only options available via this CONF object while still being available via the global cfg.CONF object. Change-Id: Ie3aa2cd090a626da8afd27ecb78853cbf279bc8b
* / / blueprint amqp-rpc-fast-reply-queueRaymond Pekowski2013-02-183-72/+359
|/ / | | | | | | | | | | | | | | | | | | | | For AMQP based RPC, specifically RabbitMQ and Qpid, this change replaces the dynamically created RPC call reply queue with a single queue that is created on the first RPC call and used on all subsequent calls. It provides backward compatibility on the callee side by recognizing downlevel callers and on the caller side by adding a config option to revert to the old dynamically created queue based upon the msg_id. Change-Id: Idb09a71472866bd3950f58d4f7f45a3181eb40fc
* | Use oslo-config-2013.1b3Mark McLoughlin2013-02-1720-1932/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cfg API is now available via the oslo-config library, so switch to it and remove the copied-and-pasted version. Add the 2013.1b3 tarball to tools/pip-requires - this will be changed to 'oslo-config>=2013.1' when oslo-config is published to pypi. This will happen in time for grizzly final. Remove the 'deps = pep8==1.3.3' and 'deps = pyflakes' from tox.ini as it means all the other deps get installed with easy_install which can't install oslo-config from the URL. Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
* | Change the check for the existence of .git directory.Robert Myers2013-02-151-2/+6
| | | | | | | | | | | | | | | | | | | | In common setup the check for the .git directory is too restrictive. Instead of checking that it is a directory just check to see if it exists. That way if the project is part of a submodule it will continue to work correctly. Change-Id: If6b6531ab5778ac17537e3f18bde1844620c8316 Fixes: bug 1126416
* | Merge "Add join_consumer_pool() to RPC connections"Jenkins2013-02-142-0/+64
|\ \
| * | Add join_consumer_pool() to RPC connectionsDoug Hellmann2013-02-132-0/+64
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | blueprint move-listener-framework-oslo bug 1047015 bug 1111632 Ceilometer and Quantum use private methods of the RPC connection object to configure themselves to listen to a queue shared among a group of workers. This change adds a public method to the RPC connection to support this use case, without resorting to using private API calls. Change-Id: I3a89f1dfdcf8accca70cf305f7a31315bea093d8 Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
* / Don't use subprocess for testing excepthookJason Kölker2013-02-131-18/+18
|/ | | | | | | | | * The previous test tested the funtionality of the excepthook using subprocess.popen. We don't need to test the interpreter, just test that our excepthook is installed and test that it functions as expected. * Fix Bug 1124617 Change-Id: Ifd8d35b842b913003100097d917d30bf66e5cb7a
* to_primitive imposes what seems to be an arbitary data structurePhil Day2013-02-121-0/+26
| | | | | | | | | | | | | | | | | | | depth of 3, but there is at least on case in Nova (Security group Rules) which requires a depth beyond this. https://bugs.launchpad.net/nova/+bug/1118608 Specifically security_group_rule_get_by_security_group returns a set of rules which have the structure: rule -> grantee_group -> Instance -> Instance_type Rather than just bumping the depth limit, which might break some other user of to_primitive we make it a specific parameter that defaults to the current value but can be over-ridden when required and log a warning when the depth is exceeded Change-Id: I1eaebd484e20cb2eae09a693289709973de9943c
* Merge "Support testing args for LocalhostMatchMaker."Jenkins2013-02-111-2/+3
|\
| * Support testing args for LocalhostMatchMaker.Eric Windisch2013-02-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The matchmaker should return the correct direct topics used by the RPC driver. The LocalhostMatchMaker was always returning 'localhost', even though our tests might use '127.0.0.1' instead. Now, the LocalhostMatchmaker will use whatever value it is told should be considered local. MatchMakerLocalhost and LocalhostExchange now take an optional host parameter. impl_zmq._get_matchmaker now passes arguments to the selected matchmaker module. The test_zmq now initializes the matchmaker, using the host '127.0.0.1' Change-Id: I8daa2c0668f1d717eb95ab56009612b8b60f0a15
* | Merge "Implements import_group"Jenkins2013-02-092-0/+38
|\ \
| * | Implements import_groupZhongyue Luo2013-01-312-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Created import_group method in cfg.py Added testcases Fixes bug #1107843 Change-Id: I427d4069dacbb6e586687370adbb08b5d50f7b63
* | | Merge "Exchanges should return directed topics."Jenkins2013-02-081-1/+21
|\ \ \
| * | | Exchanges should return directed topics.Eric Windisch2013-02-011-1/+21
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Exchanges in the matchmaker are supposed to return a directed topic as the first element in returned tuples. Adds a test to ensure this is so. Change-Id: I6c62f325914faa19216d5362c6d8ed0288942110
* | | Merge "Allow to_primitive to ignore datetimes"Jenkins2013-02-081-0/+4
|\ \ \
| * | | Allow to_primitive to ignore datetimesJoe Gordon2013-02-071-0/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for having nova.db.api not return any sqlalchemy objects. nova.db.api will return only primitives, except for datetime.datetime objects. Uses functools.partial to make code DRYING Partially implements bp db-api-cleanup Change-Id: I9980d8c4e20b05bbe734cf90ac209e4e7e89befb
* | | Use importutils.try_import() for MySQLdbMark McLoughlin2013-02-071-6/+4
| | | | | | | | | | | | | | | | | | This is a common pattern we've adopted elsewhere, so use it here too. Change-Id: I2e0947b4857005b478e796e9c9a7c05ea1f0d926
* | | Minor tweak to make update.py happyMark McLoughlin2013-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Fairly lame to do this instead of just fixing update.py, but we seem to do it this way everywhere else, so ... Change-Id: Ie1cebcfec57c6138b9b726d7d3bc6e0ea456f146
* | | Remove pointless use of OpenStackExceptionMark McLoughlin2013-02-071-2/+1
| | | | | | | | | | | | | | | | | | | | | The use of the base exception does nothing for the test but means the "dead module walking" exception module. Change-Id: Ibd7bb8aa526be366f005ab5e12fd4da89a976c57
* | | Remove unused context from test_sqlalchemyMark McLoughlin2013-02-071-2/+0
| | | | | | | | | | | | Change-Id: I0b3c7341e91cfc57aed625754bc9bf009ef70b14
* | | Remove openstack.common.db.commonMark McLoughlin2013-02-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since this only contains exceptions that are either used in session.py or utils.py (not both), it seems sensible to move them into the modules where they are used. Also, remove the use of the Invalid base exception class since we don't seem to be making use of the base class anywhere by catching it rather than the more specialized exceptions. Change-Id: Ib05bb2e0a9494e1dc60c60b8eee0e76b5d2ee555
* | | Fix missing wrap_db_error for Session.execute() methodBoris Pavlovic2013-02-071-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should add wrap_db_error for Session.execute() method, because Query.update() method will call Session.execute() and it is not inside Session.flush(), so exceptions from Query.update() wouldn't be wrapped. Add test for Session.flush() wrapper Add test for Session.execute() wrapper Fixes bug 1107890 Change-Id: I96894e502f9f279999b61a1e66469e34a07a022d
* | | Merge "timeutils: considers that now is soon"Jenkins2013-02-061-6/+11
|\ \ \
| * | | timeutils: considers that now is soonJulien Danjou2013-01-311-6/+11
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | This is a follow-up to Doug suggestion at https://review.openstack.org/#/c/20323/2/openstack/common/timeutils.py Change-Id: Ic318202234202e56054df1b5cc7f82a404c307bc Signed-off-by: Julien Danjou <julien@danjou.info>
* | | Merge "Emit a warning if RPC calls made with lock."Jenkins2013-02-061-0/+13
|\ \ \
| * | | Emit a warning if RPC calls made with lock.Michael Still2013-02-061-0/+13
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch will log a warning every time a RPC call is made while a lock is held if the caller has requested it. This should help us track down performance problems such as the security group refresh problem recently found in nova. RPC calls can emit a warning if called with check_for_lock=True and debugging is turned on. Sneaks up on bug 1063222. Change-Id: Ice94093efb3cb95dd58b31d6ba817c7d505c15af
* / | Import sqlalchemy session/models/utilsEric Windisch2013-02-054-0/+176
|/ / | | | | | | | | | | | | | | | | | | | | Bring in session, base model, utilities, and tests for sqlalchemy from Nova. Add sqlalchemy to pip-requires and and python-mysql to test-requires. Partially implements blueprint common-db Change-Id: I3e0065cdac87e10c4e0742d66c293c72bb3acbb2
* | Support for ipv6 in wsgi.ServiceDavanum Srinivas2013-02-031-1/+63
| | | | | | | | | | | | | | | | | | | | | | Enable wsgi.Service to listen on ipv6 address by checking if the host specified is ipv6. Based on that set the appropriate family in the eventlet.listen api More tests for just the ipv6, ipv6 with app, ipv6+ssl with app to make sure everything is working fine Change-Id: I2772905128bdbc69dd0fafe4ced848f5c477d7c8
* | Merge "Support for SSL in wsgi.Service"Jenkins2013-02-024-0/+185
|\ \
| * | Support for SSL in wsgi.ServiceDavanum Srinivas2013-01-294-0/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable support for SSL as well using code from glance. We have some new options for configuring the SSL support. test_app starts wsgi.Service with a test app, then creates a url to make sure the http requests are actually served properly test_app_using_router adds wsgi.Router and Mapper() to the mix along with using the wsgify annotation for serving the http requests Fixes LP# 979488 (partial) Fixes LP# 869884 (partial) DocImpact Change-Id: Iae47b13b50e00c102c8c36f4a3e73b24fa4e6303
* | | Add _FATAL_EXCEPTION_FORMAT_ERRORS global.Dan Prince2013-01-302-1/+10
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | Add a new global variable to control when exception format errors are fatal. Also, updates the Oslo test base class to enable fatal exception format errors. The motivation for this change is to give projects that use openstack common a hook to enable exception format checking when testing. Change-Id: Id8f4a0946b1614c8e987976b79069532a2e8608f
* | Add tests for setupAlessio Ababilov2013-01-301-0/+114
|/ | | | | | | | Test write_git_changelog, generate_authors, get_cmdclass, and parse_dependency_links. Also test private _run_shell_command function. Change-Id: I583d679afc1dc805c920b4beffc2f664833aabd0
* Add TTL to AMQP messagesBrent Eagles2013-01-282-5/+123
| | | | | | | | | | This patch sets a TTL derived from the timeout parameter used when invoking the RPC. Needed for: * Bug 1053614 Change-Id: Idaf9a2a972feac3f95f170c52632033b027b4414
* Merge "Prevent parallel test port clashes for zmq."Jenkins2013-01-282-6/+14
|\
| * Prevent parallel test port clashes for zmq.Monty Taylor2013-01-242-6/+14
| | | | | | | | | | | | | | | | | | The scheme of incrementing port numbers did not work so well for parallel test runs. Part of blueprint grizzly-testtools. Change-Id: I100e79ae79e4409691145dc721139d1a86839199
* | Merge "Replace direct use of testtools BaseTestCase."Jenkins2013-01-2830-132/+121
|\|
| * Replace direct use of testtools BaseTestCase.Monty Taylor2013-01-2430-132/+121
| | | | | | | | | | | | | | | | | | Using the BaseTestCase across the tests in the tree lets us put in log fixtures and consistently handle mox and stubout. Part of blueprint grizzly-testtools. Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
* | Merge "Remove the last of the nose-isms."Jenkins2013-01-281-13/+12
|\|