summaryrefslogtreecommitdiff
path: root/ceilometerclient/tests/v2
Commit message (Collapse)AuthorAgeFilesLines
* 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-3112-154/+202
| | | | | | | | | | | | | | | | | | 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 "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-141-2/+2
|\ \ \
| * | | Fix hacking rules: H302,H305,H307,H402ZhiQiang Fan2014-06-111-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-101-119/+78
|\ \ \
| * | | use mock instead of try...finallyZhiQiang Fan2014-05-301-119/+78
| |/ / | | | | | | | | | | | | | | | | | | 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
* | | 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
* | 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
* 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
* | Ensure statistics aggregates are ordered with parameterized first1.0.10Eoghan Glynn2014-04-011-3/+3
|/ | | | | | | | | | | | | Fixes bug 1298528 Due to WSME re-ordering of query parameters, in the mixed case any parameterized aggregates must be specified in the URL first, prior to any unparameterized aggregates. Otherwise the aggregate parameter will be associated with the wrong aggregate function. Change-Id: Ib2c76d03a4fc91d13074a03caade2c776d2309b3
* Implementation of statistics aggregatorsMichał Jastrzębski2014-03-272-0/+200
| | | | | | | | | | | | | | This corresponds to do API calls on: /v2/meters/meter-name/statistics?aggregate.func=func-name Usage: aggregates = [{'func': 'cardinality', 'param': 'resource_id'}]) client.statistics.list(meter_name="instance", aggregates=aggregates) CLI: ceilometer statistics -m instance -a "cardinality<-resource_id" Change-Id: I0096668585a5c7e7985973f07049eb91f44413fe
* Merge "Adds alarm time constraint support to ceilometer CLI"Jenkins2014-03-262-2/+105
|\
| * Adds alarm time constraint support to ceilometer CLIUros Jovanovic2014-03-262-2/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time constraints can be specified for create and update families of commands with the following format: --time-constraint name=constraint1;start='0 11 * * *';duration=300 This switch can be specified multiple times in the case of multiple time constraints. With update commands, time constraints are updated by name, e.g. --time-constraint name=constraint1;duration=500 updates the constraint 'constraint1' with a new duration 500. Time constraints can be removed with update commands using the switch --remove-time-constraint=constraint1,constraint2 . Example of display outputs: > ceilometer alarm-list +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | Alarm ID | Name | State | Enabled | Continuous | Alarm condition | Time constraints | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | test2 | insufficient data | True | False | cpu == 50.0 during 1 x 60s | cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ > ceilometer alarm-show -a +---------------------------+-----------------------------------------------------------------------+ | Property | Value | +---------------------------+-----------------------------------------------------------------------+ | alarm_actions | [] | | alarm_id | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | | comparison_operator | eq | | description | Alarm when cpu is eq a avg of 50.0 over 60 seconds | | enabled | True | | evaluation_periods | 1 | | exclude_outliers | False | | insufficient_data_actions | [] | | meter_name | cpu | | name | test2 | | ok_actions | [] | | period | 60 | | project_id | 962f75ad22c24cbf99d40d7b82718505 | | query | | | repeat_actions | False | | state | insufficient data | | statistic | avg | | threshold | 50.0 | | time_constraints | [{name: cons1, | | | description: Time constraint at 0 11 * * * lasting for 300 seconds, | | | start: 0 11 * * *, | | | duration: 300}, | | | {name: cons2, | | | description: Time constraint at 0 23 * * * lasting for 600 seconds, | | | start: 0 23 * * *, | | | duration: 600}] | | type | threshold | | user_id | 76f335df8e2f4c7e9e8185e26ea85759 | +---------------------------+-----------------------------------------------------------------------+ > ceilometer alarm-history -a 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 +----------+----------------------------+--------------------------------------------------------------------------------+ | Type | Timestamp | Detail | +----------+----------------------------+--------------------------------------------------------------------------------+ | creation | 2014-03-06T07:41:35.362050 | name: test2 | | | | description: Alarm when cpu is eq a avg of 50.0 over 60 seconds | | | | type: threshold | | | | rule: cpu == 50.0 during 1 x 60s | | | | time_constraints: cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +----------+----------------------------+--------------------------------------------------------------------------------+ Change-Id: I3953276537b4526e46e5e6d229d6fa154f8ab0fc Closes-Bug: #1288246
* | Add complex query support for alarm historyIldiko Vancsa2014-03-182-1/+120
| | | | | | | | Change-Id: Ie41d9a0be73a525ae105262fb5859960bf9f9df6
* | Add complex query support for alarmsBalazs Gibizer2014-03-183-2/+141
| | | | | | | | Change-Id: I3305d679d128562f7794a5cf460093981a601f7c
* | Add complex query support for samplesBalazs Gibizer2014-03-122-0/+124
|/ | | | Change-Id: I88c4eb6fa32514100187dbbca9777c7a5974fac6
* Remove unused mock in v2/test_shell.pyliu-sheng2014-02-111-1/+0
| | | | Change-Id: Ia2dd362bf30b527145635b1afd9c10bd0c2556b7
* Merge "return sample info when creating sample with CLI"Jenkins2014-01-271-0/+62
|\
| * return sample info when creating sample with CLIls11752014-01-231-0/+62
| | | | | | | | | | | | | | | | | | It will return nothing after creating a sample successfully with ceilometer CLI. The information of the sample created should be return, like other creating commands, such as "ceilometer alarm-create". Change-Id: I60229fefa91de83e4b715cf4f92d3650e0a0d162 Closes-bug: #1267713
* | Merge "Avoid discarding alarm-threshold-create --query option"Jenkins2014-01-241-0/+44
|\ \
| * | Avoid discarding alarm-threshold-create --query optionEoghan Glynn2014-01-231-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1271913 The query is crucial to the alarm evaluator statistics query being well-formed, so must not be discarded. Change-Id: I5ff8dcb420b932fc58dfef3dadfcbc4a4dc5cf66
* | | Merge "Add support for groupby in statistics for API v2"Jenkins2014-01-241-0/+52
|\ \ \ | |/ / |/| |
| * | Add support for groupby in statistics for API v2Enol Fernandez2014-01-171-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | Adds the groupby parameter to list method of Statistics and a new option "-g/--groupby" for the shell. Change-Id: I41cfa076bf73f8c01d4ee71cd70008ea231556c8 Closes-Bug: #1270094
* | | replace assertTrue(isinstance) to assertIsInstancels11752014-01-181-1/+1
|/ / | | | | | | | | | | | | | | | | some of tests use different method of assertTrue(isinstance(A, B)) or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B) provided by testtools Change-Id: Idd931d27b13a46800e27393a98da096d41442320 Closes-bug: #1268480
* | Merge "Python 3: fix test_sample_list"Jenkins2014-01-151-3/+3
|\ \
| * | Python 3: fix test_sample_listCyril Roelandt2014-01-101-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the counter_volume field of "fake" samples to get compatibility with both Python 2 and 3. In Python 2: >>> print(str(0.261666666666667)) 0.261666666667 In Python 3: >>> print(str(0.261666666666667)) 0.261666666666667 Change-Id: I4beed7aff7e89f891024975b9df9208c987dc87c
* | Support the Event APIJohn Herndon2014-01-1010-18/+444
|/ | | | | | | | | | | | This patch adds support for the currently available Event API, including events, event types, and traits. Add an optional data type to the query, ex: ceilometer list-events -q 'hostname=string::localhost" bp extend-client-operations Change-Id: Icea9bd67f8ee4ff2bf9da9ff6894218689580eb3
* Merge "Allow alarm-threshold-update to upate generic attributes"1.0.7Jenkins2013-11-281-5/+32
|\
| * Allow alarm-threshold-update to upate generic attributesEoghan Glynn2013-11-221-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | Fixes bug 1253989 Previously, generic (i.e. non-threshold-related) alarm attributes could not be updated with the alarm-threshold-update command. An attempt to do so failed semi-silently when a non-existent dict key was referenced. Now, all alarm attributes can be updated with this command. Change-Id: Iba3f21de879fb853575dcec1730de7873eab8afd
* | Enable pep8 E711/E712/E721/H302 checkingLianhao Lu2013-11-221-1/+2
| | | | | | | | Change-Id: I229f1c15b46284fae94d4c786765baa18da0055f
* | Enable pep8 E128 checkingLianhao Lu2013-11-221-1/+1
| | | | | | | | Change-Id: I31dc17f0faaae1c32e5106873fd13158376367f7
* | Enable pep8 E121/E122/E123 checkingLianhao Lu2013-11-222-17/+15
|/ | | | Change-Id: I686f2b7895868e6ebaabe5d274e3efde2dd9c441
* Avoid reset of repeat_actions attribute on alarm updateEoghan Glynn2013-11-211-0/+67
| | | | | | | | | | | | | Fixes bug 1253057 Previously, when an unrelated alarm attribute was updated via the CLI, the repeat_actions attribute was also set to False as an unwanted side-effect. Now, we only set this attribute in the update call if explicitly specified as a CLI arg. Otherwise the value provided in the PUT request body reflects the pre-existing value for this attribute. Change-Id: I94468ff649dd4367848c74e94a3feb08494bb223
* Adds the 'limit' parameter to sample list command in V2 APINejc Saje2013-10-282-1/+17
| | | | | Change-Id: I338590fcd75f39c3419e7e138023f6918f206ae2 Fixes: bug #1244172