summaryrefslogtreecommitdiff
path: root/ceilometerclient/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge "Fix improper parameter setup for cacert and client certs"Jenkins2015-01-161-2/+16
|\ \
| * | Fix improper parameter setup for cacert and client certsSrinivas Sakhamuri2015-01-151-2/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The client passes cacert incorrectly, CA cert need to be passed in verify parameter to requests library. Also at present, key file is not being used, which if it is supplied need to be passed as a tuple in cert parameter Python requests library relevant doc link http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification Change-Id: Ie71e760bce6a78ed1444373adfa0a133e82ec434 Closes-Bug: 1408372
* | event-list should sort by timestamp, not idZhiQiang Fan2015-01-131-0/+46
|/ | | | | | | | | | Currently, event-list output will be sorted by message id, that is because table field 0 is the default sort field. But sort by id makes no sense, and REST API returns events by timestamp order, so let's keep consistent with upstream. Change-Id: I524b05ed5ff9db34430afd722991d02545c263cb Closes-Bug: #1406622
* Support ceilometer-url and os-endpointZhiQiang Fan2015-01-081-0/+18
| | | | | | | | | Ceilometerclient has messed up with (ceilometer-url and os-endpoint) and (os-auth-token and token). This patch marks ceilometer-url and auth-token as deprecated, and unifies the two pairs arguments. Change-Id: Id55e5b603d8075018cf45b9833d397173439b3ce Closes-Bug: #1396811
* Merge "Enable --os-insecure CLI option"Jenkins2015-01-072-1/+37
|\
| * Enable --os-insecure CLI optionZhiQiang Fan2014-12-062-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | --os-insecure is not correctly passed to Keystoneclient because it expects a bool type but we assgin a string value to the insecure parameter, this patch fixes it by using oslo.utils.strutils.bool_from_string. --os-insecure is ignored by Ceilometerclient.v2.client because it expects parameter verify rather than insecure, this patch fixes it by converting insecure to verify if that field is not set. Change-Id: I545de167cdf8cfec6b5c67984b74327fb76c513a Closes-Bug: #1394449
* | Make methods static where it's possibleDina Belova2014-12-102-2/+4
| | | | | | | | Change-Id: If6c1fa05044e65ec1e72a3e5f63e6db826469a2d
* | Fix old-style classes declarationDina Belova2014-12-102-5/+5
|/ | | | Change-Id: I8759dd64637e5150f6744d0989eaa5e584487f5e
* Alarm TimeConstraint display incorrectRohit Jaiswal2014-11-251-0/+32
| | | | | | | Added test case for print_dict function Change-Id: I3ab8a4e25f946b409ede2a598a5b9cf8593a044e Closes-Bug: #1395110
* Merge "Fix wrong initialization of AuthPlugin for keystone v3"Jenkins2014-11-251-7/+34
|\
| * Fix wrong initialization of AuthPlugin for keystone v3ZhiQiang Fan2014-11-111-7/+34
| | | | | | | | | | | | | | | | Ceilometerclient doesn't pass domain related arguments to AuthPlugin, which will cause keystoneclient v3 cannot be used properly. Change-Id: I2554a36f214c0eae61b7ba6b8580c41b8f8c6370 Closes-Bug: #1391122
* | Fix timeout argument not treated as integerZhiQiang Fan2014-11-142-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | Currently, if we specify --timeout 30 in CLI commands. we will get 'a float is required' error. Since we already specify timeout is ingeter in ceilometer.v2.client, this patch converts CLI argument timeout to integer. Note, if zero is passed to v2.client, we treat it as disable timeout. Change-Id: I213b6c24964095297cb4e87c25bb871ebd668bb4 Closes-Bug: #1391606
* | Refactor tests/test_shell.pyZhiQiang Fan2014-11-131-18/+10
|/ | | | | | | Remove unnecessary help test for keystone shell test. Change-Id: I4891a3e7d13f924ba0a1f7c57e87cd092ed8f9ff Closes-Bug: #1391965
* Merge "Reduce redundant parameter of some commands in CLI"Jenkins2014-09-201-8/+30
|\
| * Reduce redundant parameter of some commands in CLIls11752014-09-191-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deleting an alarm, we use "ceilometer alarm-delete -a <ALARM_ID>", unlike other deleting commands of openstack, the parameter-a/--alarm_id is redundant. The similar situations exist in showing alarm, geting alarm state, showing resource and so on. It is more easy to use for reducing these parameters. New behaviour: $ ceilometer help alarm-show usage: ceilometer alarm-show [<ALARM_ID>] Show an alarm. Positional arguments: <ALARM_ID> ID of the alarm to show. $ ceilometer alarm-show alarm_id should not be empty $ ceilometer alarm-show abcde Not Found (HTTP 404) $ ceilometer alarm-show -a abcde -a is obsolete! See help for more details. Not Found (HTTP 404) $ ceilometer alarm-show --alarm_id abcde --alarm_id is obsolete! See help for more details. Not Found (HTTP 404) Co-Authored-By: Nejc Saje <nsaje@redhat.com> Change-Id: I1fbc85aa253929bfbb5e73ed834a725b9cf828b4 Closes-bug: #1268557
* | Merge "Verify alarm found before modifying"Jenkins2014-09-131-0/+20
|\ \
| * | Verify alarm found before modifyingEric Pendergrass2014-08-291-0/+20
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current behavior is to retrieve alarm by id and conduct operations on the object. If the tenant doesn't own the alarm or isn't admin, the user will receive the message: 'NoneType' object has no attribute 'to_dict' Above message doesn't provide any useful diagnostic information and indicates a programming error since an unexpected None-type is encountered and not handled. This change verifies the alarm is found before using the object. If alarm not found it prints the same message for a not found Alarm as other PUT operations like alarm-state-set: Alarm not found: <alarm_id>. This message is more useful for diagnosis and gets rid of the uncaught None-type error. Change-Id: I66abcd4498b24ac7cadcf29fe3ced3fcda08458c Closes-Bug: #1348387
* | Fix sample-create in v2 api callsChris Dent2014-09-101-1/+1
|/ | | | | | | | | | | | | A dict embedded in a list is the expected input. In 47934c777c50897b649793e0960eebdaad322c45 the list was lost, this puts it back. Note that the _exact_ date of this failure was identified by existing Rally jobs which started failing in early August. That made searching the commit logs straightforward. Change-Id: I37e794de7a23b8ce8e67a086732af5a19f182409 Closes-Bug: #1367867
* Merge "Check if the alarm has time constraints field before displaying"Jenkins2014-08-281-5/+40
|\
| * Check if the alarm has time constraints field before displayingNejc Saje2014-08-251-5/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the bug that broke the alarms CLI if the alarm didn't have a time constraints field. Reduces code duplication of alarm printing code, so now all the alarm printing code is actually tested. Renames some auxiliary methods for more clarity. Change-Id: Ib691b4a5a6cf5ae133cd0a5576f90e4d0d189a92 Closes-bug: #1316390
* | Replace assertTrue with assertIsNotNone for check an objectjoey56782014-08-114-17/+16
| | | | | | | | | | | | | | | | | | assertTrue(*) means to check whether a boolean value/expression is true or not. For checking an object is not None, we should use assertIsNotNone(*), which gives more explicit expression. Change-Id: Ia4d0dcec81e97fe4774bff4e41a017f00b899ef3 Closes-Bug: #1297156
* | Use HTTPClient from common Oslo codeekudryashova2014-07-3121-350/+310
| | | | | | | | | | | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. bp common-client-library-2 Change-Id: I0e027c33ee42b6de032d33269caeea33e7837f40
* | Merge "Avoid empty entity field in uri path"Jenkins2014-07-241-0/+81
|\ \
| * | Avoid empty entity field in uri pathZhiQiang Fan2014-05-271-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, empty entity field is accepted but will fail when call cli, it is because the empty field leads to incorrect rest api uri, which will get 404 error. This patch checks some required entity fields, which will present in uri path, and raises CommandError if they are empty. Note the other required fields will not cause the same problem, so they are not checked. Change-Id: I59411b760ff7457064b386911e868518b3057e3a Closes-Bug: #1313679
* | | Use suitable assertliuqing2014-07-092-4/+4
| |/ |/| | | | | | | | | | | | | Replace assertTrue(a in b) with assertIn(a, b) Replace assertFalse(a in b) with assertNotIn(a, b) Replace assertTrue(a is None) with assertIsNone(a) Change-Id: I981c81908a823d9dbecbb2e139a86fbf589ce55e
* | Merge "Update python-ceilometerclient to support Keystone V3 API"Jenkins2014-06-272-16/+54
|\ \
| * | Update python-ceilometerclient to support Keystone V3 APIFabio Giannetti2014-06-262-16/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keystone is now deprecating the V2 API in favor of the V3 API. The ceilometer client is now using the keystone session to delegate the discovery of the version that is going to be used, this eliminates the need of updating the client every time there is a new API version. DocImpact blueprint support-keystone-v3-api Change-Id: I6ebacce7adf70f24bdede9b920853ab9851071cf
* | | Merge "Fix alarm-threshold-update --query option"Jenkins2014-06-251-15/+31
|\ \ \
| * | | Fix alarm-threshold-update --query optionZhiQiang Fan2014-06-111-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, alarm-threshold-update command can not update its query field, because the dest value is removed accidently so the query is not put under threshold_rule dict. This patch simply adds it back. Change-Id: I2eeaf8cbb26f506e097dafdcb6d0eae4ad7fec3e Closes-Bug: #1313676
* | | | Add methods to resource classesArtur Svechnikov2014-06-163-17/+77
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resource classes of managers should have methods like delete() and get(). Basicly base.Resource class has method get(), which uses id attribute, but classes Alarm, Event, etc. have no this attribute. Added intercept getting of id in the resource classes. Also added catch of HTTPNotFound for alarm get() because it affects correct functionality of scenario tests. Closes-Bug: #1312146 Change-Id: Ie598b73c64dece2185955467936dc6544a8a3dc7
* | | Merge "Fix hacking rules: H302,H305,H307,H402"Jenkins2014-06-145-7/+6
|\ \ \
| * | | Fix hacking rules: H302,H305,H307,H402ZhiQiang Fan2014-06-115-7/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, OpenStack Proposal Bot tries to update requirements with global requirements, while the upgraded hacking has introduced some new rules which are not fully handled by current code. This patch fixes some simple rules which are quite straight-forward. Change-Id: If8334f69fb1ad34fbbd6ad898e0e92eb3f81e95a
* | | Merge "Remove © and remove unnecessary encoding lines"Jenkins2014-06-125-6/+1
|\ \ \ | |/ / |/| |
| * | Remove © and remove unnecessary encoding linesMartin Geisler2014-05-305-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The word "Copyright" alone is sufficient to claim copyright, the © need not be present.[1] As per PEP 263, a Python file with non-ASCII characters must have a line with "coding: <some-encoding>". Python files containing only 7-bit ASCII characters need no such line.[2] This commit removes unnecessary Unicode copyright symbols and unnecessary encoding lines. [1]: http://www.copyright.gov/circs/circ03.pdf [2]: http://legacy.python.org/dev/peps/pep-0263/ Change-Id: I6b43cc5ecfd0440e06b0aebd91ebb574b7f37a91
* | | Merge "use mock instead of try...finally"Jenkins2014-06-103-142/+85
|\ \ \
| * | | use mock instead of try...finallyZhiQiang Fan2014-05-303-142/+85
| |/ / | | | | | | | | | | | | | | | | | | There are some test code use try...finally block to catch or ignore the stdout message. The job can be done by mock too, and it is cleaner. Change-Id: I0c29382e7bcd0b7f399565b26f27315f7e17a8fc
* | | Merge "Avoid unnecessary stderr message when run test"Jenkins2014-06-091-1/+2
|\ \ \
| * | | Avoid unnecessary stderr message when run testZhiQiang Fan2014-05-271-1/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Currently, if we run `tox -epy27`, we will get an useless stderr message 'HTTPUnauthorized (HTTP 401)', which is triggered on purpose by a test. It should be mocked because it provides no such useful message. Change-Id: I009310257741a34fe966d6d745de3c6cf58e0feb Closes-Bug: #1323480
* | | Refactor split_by_op and split_by_datatypeChris Dent2014-06-021-3/+89
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | split_by_op was returning data against which further error checking was then required. This change moves that error handling inside the method and simplifies the regular expression so that it splits (greedily) on the first operator it finds. If the split is not possible, it is a ValueError. If the field or value are empty, that is a ValueError. Both split_by_op and split_by_datatype were doing a findall() where a match() and split() do the right job and more efficiently. Regular expression compilation has been moved to the module level to insure they need only be compiled once. Operator keys must be sorted by length to ensure the point at which the split happens is most greedy. Using a split keeps the regex short and removes any statements about the left and right hand sides of the operator. Tests added to cover the method more completely, including testing for corner cases such as single character field or values or operators showing up in unexpected locations. 'string' variable renamed to 'query' and 'query_value' to avoid confusion. Named parameters on string substitution for clarity. Note that the tests which do self.assertRaises could more explicitly check the exception with self.assertRaisesRegexp but that would break compatibility with Python 2.6. Change-Id: Icd815ff65aba9eae3f76afee3bb33e85d85bea72 Closes-Bug: #1314544
* | Merge "fixed several pep8 issues"Jenkins2014-05-291-12/+14
|\ \ | |/ |/|
| * fixed several pep8 issuesChristian Berendt2014-05-161-12/+14
| | | | | | | | | | | | | | | | | | | | | | * E122 continuation line missing indentation or outdented * E126 continuation line over-indented for hanging indent * E128 continuation line under-indented for visual indent * E265 block comment should start with '# ' Tested with pep8 version 1.5.6 (2014-04-14). Change-Id: Iaea72c74d3678061b0ac837eb8fe8c85a883bb4a
* | Remove out-dated exceptionsZhiQiang Fan2014-05-161-3/+3
|/ | | | | | | | There are some exceptions defined in exc module, which is introduced two years ago, and it is marked as DEPRECATED in the same time. It should be removed for now, since there are no longer used. Change-Id: I039575f37b0e6d1c30e447b74d61b8cd0b6bbd29
* Merge "Avoid dead loop when token is string format"Jenkins2014-05-021-8/+10
|\
| * Avoid dead loop when token is string formatZhiQiang Fan2014-04-261-8/+10
| | | | | | | | | | | | | | | | | | | | The token needs to be a callable object in http.Client, so we assign a lambda expression to it when it is a string, but current implementation will cause dead loop since it is x = lambda: x. This patch fixes it and improves the corresponding test code. Change-Id: Id41edd705b46196404e5cb3483a290074bde12d0 Closes-Bug: #1301877
* | Merge "Display message on HTTPException"Jenkins2014-05-021-17/+38
|\ \
| * | Display message on HTTPExceptionliu-sheng2014-04-171-17/+38
| |/ | | | | | | | | | | | | | | Display the faultstring of HTTPException if available, such as HTTPBadRequest(400) error and HTTPNotFound(404) error. Change-Id: I1c361ff5d02ded4af429f94fd4299d2de3798488 Closes-bug: #1297769
* | Merge "Correct testcase content"Jenkins2014-04-231-5/+5
|\ \ | |/ |/|
| * Correct testcase contentIldiko Vancsa2014-04-041-5/+5
| | | | | | | | | | | | | | | | There were two test cases in test_http.py, where the input data was the exact same into the two cases, which means that there is an uncovered case for the url formats currently. The test cases are renamed properly. Change-Id: I224035e0959116668494a8b64af34eabeea1c251
* | Merge "Statistics groupby handling improvement"Jenkins2014-04-121-0/+20
|\ \ | |/ |/|
| * Statistics groupby handling improvementStéphane Albert2014-03-281-0/+20
| | | | | | | | | | | | | | | | | | The groupby parameter for statistics now handle single string as a parameter. It fixes the bug where every characters of the string where interpreted as a groupby value. Change-Id: Ia763741d7ad5717be381b0ac2f0acb57e9f46cac Closes-Bug: #1291935