summaryrefslogtreecommitdiff
path: root/gear/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Replace assertEquals with assertEqual"0.9.0Jenkins2017-05-171-10/+10
|\
| * Replace assertEquals with assertEqualLuong Anh Tuan2016-11-221-10/+10
| | | | | | | | | | | | | | | | | | | | | | The method assertEquals has been deprecated since python 2.7. http://docs.python.org/2/library/unittest.html#deprecated-aliases Also in Python 3, a deprecated warning is raised when using assertEquals therefore we should use assertEqual instead. Change-Id: Ic99ea3f57bb6fd986ce2626e800e3d310a2e3df7 Closes-Bug: #1218185
* | Provide TextJob and TextWorker for convenienceClint Byrum2017-05-151-0/+75
| | | | | | | | | | | | | | These classes will provide a smoother path from python2 -> python3 when using gear, as it will relieve the need for encoding/decoding. Change-Id: I93bfe33f898294f30a82c0a24a18a081f9752354
* | Make Job.name assume utf-8.Clint Byrum2016-11-161-0/+11
|/ | | | | | | This breaks the API in subtle ways, but only really for people who want to use Python 3 and/or not utf-8 function names. Change-Id: If6bfc35d916cfb84d630af59f4fde4ccae5187d4
* Re-enable flake8Monty Taylor2016-11-081-1/+1
| | | | | | | | | | | | The line in tox.ini "select=H231" did not add H231 to the list of flake8 checks. It made us only run H231. Remove the H231 line and then fix the flake8 issues. The most substantial of these was the shadowing of the queue module with local variables named queue. Made that one import queue as queue_mod because changing the variable names in the code was yuckier to look at. Change-Id: I4a26a20889132f7f4525b17392088dda6bd5bbd2
* Merge "Allow setting a timeout for Client.waitForServer()"0.7.0Jenkins2016-07-211-0/+6
|\
| * Allow setting a timeout for Client.waitForServer()Sam Thursfield2016-04-121-0/+6
| | | | | | | | Change-Id: I614de364a668b1ae01ad361254fd4afcdfe48051
* | Add test for AdminRequest.isCompleteJames E. Blair2016-07-181-0/+29
| | | | | | | | Change-Id: I16fd6b6debc3171ec9a346be079c32018e5b5f64
* | Merge "Add a test for worker termination"Jenkins2016-06-022-1/+17
|\ \
| * | Add a test for worker terminationJames E. Blair2015-12-032-1/+17
| |/ | | | | | | | | | | | | | | This was an attempt to find a code path that could cause stopWaitingForJobs to raise an exception. So far, that has failed, but add this test anyway to exercise some of that code. Change-Id: I39955fc7250af9b93f336c7c3e0315528bd8d4a9
* | Guard against double shutdown in client0.5.9Gregory Haynes2016-01-261-0/+5
|/ | | | | | | If we have already performed a shutdown we can prevent exploding when writing to self.wake_write if we short circuit. Change-Id: If5352a373d5fa61dd1ee661f4a37976b3447dd9d
* Resolve python3 test failuresClint Byrum2015-03-112-8/+8
| | | | | | | | | | | | | | | | | | Under python3.4, "" or 'misc' is not a bytearray anymore. Tests for this type would fail in python3.4, even though the arguments are explicitly called out as "bytes". Several test failures in python3.4 are related to byte strings returning ints and default strings no longer counting as byte strings. In python3, sort does not take a cmp function but a key function. Also dict.items() returns a dict_items object which cannot be sorted, but can be converted into a list(). Also in python3 the crypto.dump_ methods return bytes instead of strings. Change-Id: I36fde6475f6cc517c1a9c3c135c28d3ea61e6a4a
* Add SSL functional testJames E. Blair2015-03-111-11/+79
| | | | Change-Id: Ia78a5ba94349830b5e7e9a48dd8eee081fe458ea
* Fix SSL non-blocking IO supportJames E. Blair2014-12-231-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an SSL socket is in non-blocking mode, EAGAIN is essentially masked by WANT_READ or WANT_WRITE. So treat EAGAIN, WANT_READ, and WANT_WRITE as equivalent. The reason for treating them as equivalent in non-blocking mode is that the following cases can happen: While reading, we might get: SSL_WANT_READ: This is the same as EAGAIN. SSL_WANT_WRITE: We need to wait until the edge poll triggers with POLLOUT signalling that we can write again. When that happens, we should retry this read call. While writing, we might get: SSL_WANT_READ: We need to wait until the edge poll triggers with POLLIN signalling that we can read again. When that happens, we should retry this write call. SSL_WANT_WRITE: This is the same as EAGAIN. This suggests that any time we receive either of the SSL_WANT responses, we should wait until either IN or OUT is edge-triggered, and always attempt to both read and write every time IN or OUT is triggered. To do this, mask WANT_READ, WANT_WRITE, and EAGAIN with a new exception that simply indicates internally to gear to retry the IO operation after the next poll trigger. Change-Id: Ib2be2fc97f13a95b4d082a54222013be4ecd4384
* Add simple functional testJames E. Blair2014-12-231-0/+62
| | | | | | | Exercises the typical lifecycle of a job with a client, worker, and server. Change-Id: I2ac80d7a772ab9fe80e1883810d8ab273d4958ee
* Add admin readPacket unit testsJames E. Blair2014-12-181-0/+60
| | | | Change-Id: I0ed501df1fa40f481519fe3421eeff5b07afff62
* Add unit test for readPacket (client mode)James E. Blair2014-12-182-11/+69
| | | | | | | recv is updated to correct a bug when transitioning across packets when in blocking mode, as well as to have more consistent code. Change-Id: Id1c0e8178e6d79d1bf7972c9dfe18673fd6a033c
* Add readPacket unit testJames E. Blair2014-12-182-0/+97
| | | | | | Add a unit test for readPacket as used by ServerConnection. Change-Id: I8117152b2429407b9d41d146facb63fb70a185f7
* Add access controlJames E. Blair2014-04-221-0/+56
| | | | | | | | | | | | | | | | | | | | | The gear server is modified to check an access control list for certain actions if SSL and ACLs are enabled. Clients and workers can be granted permission to register and invoke only functions matching certain regexes, as well as the ability to grant ACLs to other connections. A connection can always revoke its own access. ACL entries are checked based on the subject name in the SSL certificate (which is trustworthy because only certificates signed by the supplied CA are accepted). The submitJob method is updated to give up sooner if it is unable to submit a job to any connected servers (older behavior would busy loop trying to submit it, but since there are now more scenarios where a functioning gear server might reject a job, that behavior seems less desirable). Docs and tests are updated for the new feature. Change-Id: I07edfb964bf716df08be86f844061bdad29b9728
* Correctly set job known/running attributesDerek Higgins2013-11-281-0/+31
| | | | | | | | In Client.handleStatusRes the known and complete arguments in STATUS_RES packets were being compared to integers, they should be compared to strings. Change-Id: I170ee12955263065a4adff4221e5bc60015cae70
* Make flake8 and OpenStack Hacking clean.Monty Taylor2013-04-081-3/+0
| | | | Change-Id: Ifbc78187e29e7befefcfff47b803ff20c86f6e75
* Add initial test suite.Monty Taylor2013-04-082-0/+97
Change-Id: I4fdbc8d6c3073b7edfdc8bf486575820088faa72