summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute
Commit message (Collapse)AuthorAgeFilesLines
* Refactor service unit testsTang Chen2016-05-252-73/+101
| | | | | | | Add a FakeService class, and refactor service unit tests to use this class. Change-Id: I650ad83386a58205ebe42274d2bf2f508436bfa6
* Merge "Enhance exception handling for "network delete" command"Jenkins2016-05-171-0/+19
|\
| * Enhance exception handling for "network delete" commandTang Chen2016-04-141-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch rework "network delete" command following the rules in doc/source/command-errors.rst. In "network delete" command, there are multiple REST API calls, and we should make as many of them as possible. And log error for each one, give a better error message. Also return a non-zero exit code. Change-Id: I39ae087dd7bd08d049d513abfa6c5cab2bd13b2b Partial-Bug: #1556719
* | Merge "Add unit tests for "server show" command"Jenkins2016-05-111-0/+95
|\ \
| * | Add unit tests for "server show" commandTang Chen2016-05-111-0/+95
| | | | | | | | | | | | Change-Id: I6eb0c4e7d5d3e677764b253e3324720a784a110b
* | | Merge "Use find_resource() instead of get() in _prep_server_detail()"Jenkins2016-05-111-7/+5
|\ \ \ | |/ / |/| |
| * | Use find_resource() instead of get() in _prep_server_detail()Tang Chen2016-05-091-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is such a comment in test_server.py: # Call .get() to retrieve all of the server information # as findall(name=blah) and REST /details are not the same # and do not return flavor and image information. This is an out of date comment. There is no function named findall() in OSC now. So use find_resource() instead of get(), and remove this comment. Change-Id: I8d79afc5f341fb5caf771d905506b7f1c7a41ae8
* | | Merge "Map server power state num to meanful string"Jenkins2016-05-092-1/+7
|\ \ \ | |/ / |/| |
| * | Map server power state num to meanful stringTang Chen2016-05-072-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In _prep_server_detail(), power_state is not formatted by _format_servers_list_power_state(). So when executing "server show" or "server create", the power state is represented by number. This patch map the numbers to meanful strings. This patch also adds power_state attribute to FakeServer, and improves unit tests for this attribute. Change-Id: I2ec674327de4e5133b8712ba6bb53fa5ce55e3f4
* | | Merge "Trivial: Remove unuseful comments for assertRaise() checking"Jenkins2016-05-071-1/+0
|\ \ \ | |/ / |/| |
| * | Trivial: Remove unuseful comments for assertRaise() checkingTang Chen2016-05-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | "Missing required args should bail here" is not understandable and not necessary. The code is obvious enough. And some of the comments are misused because of code copy. So remove them. Change-Id: I031395f2c882386c7a708db5cf4eee75393dc639
* | | Merge "Make "flavor show" command to show a private flavor properly"Jenkins2016-05-061-13/+9
|\ \ \ | |/ / |/| |
| * | Make "flavor show" command to show a private flavor properlyHuanxuan Ao2016-05-021-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "flavor show" command could not show a private flavor by flavor name becauce it could not find a private flavor by flavor name. In "until.find_resource(parsed_args.flavor)", If parsed_args.falvor is a name of a flavor, "flavors.find(name=parsed_args.flavor)"will be called to find a flavor.But the default value of "is_public" is "Ture" in "flavors.find()" so that we can only find public flavors.If we want to find all flaovrs by flavor name,we should add "is_public=None" in "flavors.find()". So I tried to change "until.find_resource(parsed_args.flavor)" to "until.find_resource(parsed_args.flavor, is_public=None)", but then I could not find any flavor by flavor id because "is_public" is an unexpected argument of "flavors.get()" in "until.find_resource()". In this case,I think "until.find_resource()" can not find a private flavor properly,and we should combine "manager.get(flavor.id)" and "manager.find(name=flavor.name, is_public=None)" by ourselve to find a flavor. Also,this bug affects other flavor commands like "flavor set/unset/delete",so I fix them in this patch too. Change-Id: I4a4ed7b0a2f522ee04d1c3270afcda7064285c39 Closes-Bug: #1575478
* | | Add a unit test for "flavor create" commandHuanxuan Ao2016-05-042-2/+162
|/ / | | | | | | | | | | | | There was not a unit test for "flavor create" command in the "test_flavor.py".So I add the unit test. Change-Id: Ib1e821ea524eb33c0ba73643164228c7b83253b4
* | Fix error in flavor set/unset commandHuanxuan Ao2016-04-281-4/+8
| | | | | | | | | | | | | | | | | | | | In the "flavor set/unset" command,the "flavor" parameter can be a name but can not be a id of a flavor. I think we should find a flavor by using "utils.find_resource()" in these commands. Change-Id: I5836788f7ed18813f1ebde31bb808b7c3f932b80 Closes-Bug: #1575624
* | Merge "Add "server group show" command"Jenkins2016-04-201-0/+23
|\ \
| * | Add "server group show" commandRui Chen2016-04-201-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Support compute v2 "server group show" command in OSC. Implements: blueprint nova-server-group-support Closes-Bug: #1542171 Change-Id: I1a6d103151c704bda5b67cb9a49cc43c7d9f1d6a
* | | Merge "Fix mutable default arguments in tests"Jenkins2016-04-201-26/+33
|\ \ \ | |/ / |/| |
| * | Fix mutable default arguments in testsTang Chen2016-04-201-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python’s default arguments are evaluated only once when the function is defined, not each time the function is called. This means that if you use a mutable default argument (like list and dict) and mutate it, you will and have mutated that object for all future calls to the function as well. More details about this wrong usage here: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments In unit tests, most FakeXXX classes' methods take mutable arguments with default values [] or {}. We should change them to None. Change-Id: Iea833b66aa1379829511ad5c6d4432b72f3488e2 Closed-bug: #1550320
* | | Add "server group list" commandRui Chen2016-04-201-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | Support compute v2 "server group list" command in OSC. Implements: blueprint nova-server-group-support Partial-Bug: #1542171 Change-Id: I68b80e3c4458692472af671028cd1f939736bcb8
* | | Add "server group delete" commandRui Chen2016-04-201-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support compute v2 "server group delete" command in OSC. Implements: blueprint nova-server-group-support Partial-Bug: #1542171 Related-Bug: #1563301 Change-Id: I7d792d669b147b24dc774844cfc9dbacd60d017b
* | | Add "server group create" commandRui Chen2016-04-202-0/+142
|/ / | | | | | | | | | | | | | | | | Support compute v2 "server group create" command in OSC. Implements: blueprint nova-server-group-support Partial-Bug: #1542171 Change-Id: I96ffb07764d3adb715e048943cfee3b879c280f6
* | Remove methods argument from FakeHypervisorStatsTang Chen2016-04-151-2/+1
| | | | | | | | | | | | | | methods argument is not necessary in FakeHypervisorStats class. Remove it. Change-Id: I288f71b412beb3e583e957a9fd99210bc6f3f543
* | Remove fake methods code from compute networkTang Chen2016-04-121-77/+15
|/ | | | | | | | | | | | Network objects don't have any method needs to fake. keys() method is only used by _get_columns() helper to obtain all attributes of an object. But in compute network implementation, attributes are obtained from obj._info directly, which is a dictionary itself. So there is no need to fake this method. Change-Id: Ie6a46ef6a3042641e55a7002573ef501db7b60e1
* Merge "Refactor security group rule list to use SDK"Jenkins2016-04-111-229/+0
|\
| * Refactor security group rule list to use SDKRichard Theis2016-03-281-229/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group rule list' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. In addition, a release note was added to document the features and fixes resulting from this refactor. Change-Id: I24d04b720102ed1c60776e1ca67d4ca20e31b663 Partial-Bug: #1519512 Implements: blueprint neutron-client
* | Merge "Log hint when --enable present with --disable-reason"Jenkins2016-04-061-9/+64
|\ \
| * | Log hint when --enable present with --disable-reasonRui Chen2016-04-051-9/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --enable and --disable-reason should be mutually exclusive in "compute service set" command, but now when they are present at the same time, --disable-reason would be ignored silently. Fix these and add some hints about --disable-reason argument is ignored in this situation. Change-Id: I43254b6bc40fcae4fd0dc3457f26fad84c267072 Closes-Bug: #1556801
* | | Trivial: Rename FakehypervisorStats to FakeHypervisorStatsTang Chen2016-04-052-3/+3
|/ / | | | | | | Change-Id: I138b1b8a3327947b8cd032d8d0c32d98548ce2ad
* | Merge "Add unit tests for compute v2 aggregate"Jenkins2016-03-301-5/+331
|\ \
| * | Add unit tests for compute v2 aggregateRui Chen2016-03-261-5/+331
| | | | | | | | | | | | | | | | | | | | | | | | This patch add the complete unit tests to cover compute v2 aggregate object. Change-Id: Ifcf9248eabb5ca3ee5ca01c5843e96ba681c3b5a Closes-Bug: #1560832
* | | Merge "Add "aggregate unset" to osc"Jenkins2016-03-302-0/+98
|\ \ \ | |/ / | | / | |/ |/|
| * Add "aggregate unset" to oscRui Chen2016-03-242-0/+98
| | | | | | | | | | | | | | | | Support "aggregate unset" command in order to remove the property of aggregate object in OSC. Change-Id: I49645135586362f0fd251f5e4a4c03eff273d9e9 Closes-Bug: #1559866
* | Refactor security group rule create to use SDKRichard Theis2016-03-232-269/+3
|/ | | | | | | | | | | | | Refactored the 'os security group rule create' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. Change-Id: I8c6c99d5272ff5d410a449f73d198d834c5cd96e Partial-Bug: #1519512 Implements: blueprint neutron-client
* Merge "[compute] Add set host command"Jenkins2016-03-172-0/+131
|\
| * [compute] Add set host commandjichenjc2016-02-262-0/+131
| | | | | | | | | | | | set host command is missing, add it as SetHost class. Change-Id: I7acb94150718b7150598632cbebc3d85018a0d59
* | Support "--long" option in ListServiceRui Chen2016-03-142-1/+27
| | | | | | | | | | | | | | | | Add "--long" option in ListService so that compute service disabled reason can be showed. Change-Id: I1ace8f1c4e4efe0a1a8f6710425d73eb5db9e5e1 Closes-Bug: #1556815
* | Refactor security group create to use SDKRichard Theis2016-03-101-127/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group create' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. The tenant_id column name was fixed to align with the 'os security group show' command. Change-Id: Ib29df42edcddcc73a123fff6a64743a6bfcb7fbf Partial-Bug: #1519511 Implements: blueprint neutron-client
* | Refactor security group show to use SDKRichard Theis2016-03-101-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group show' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. The column names remain unchanged to maintain backwards compatibility. Change-Id: I25233ddb8115d18b8b88affb3de13346084a339d Partial-Bug: #1519511 Implements: blueprint neutron-client
* | Merge "Remove FakeFlavorResource class"Jenkins2016-03-091-29/+16
|\ \
| * | Remove FakeFlavorResource classTang Chen2016-03-091-29/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | In unit tests, all real methods are faked. They should not do any real operations in the tests. So, FakeFlavorResource is not necessary. Just fake get_keys(), set_keys and unset_keys() in FakeResource would be enough. Change-Id: Icc3473ba9c77f4817d0edddb7ff3e1bd2946fac7
* | | Merge "Add --reason for disable service"Jenkins2016-03-091-0/+26
|\ \ \ | |/ / |/| |
| * | Add --reason for disable servicejichenjc2016-03-091-0/+26
| | | | | | | | | | | | | | | | | | | | | disbale service allow a reason to be input as disable reason. This patch add support for it. Change-Id: I59622c3970e055ebd46bf03c33c864b6d064db28
* | | Trivial: Fix incorrect comments in compute fakes.pyTang Chen2016-03-081-3/+3
| |/ |/| | | | | Change-Id: I18b1720af13b444527dda1ecab52e3cc8d8d9376
* | Merge "[compute] Support restore server"Jenkins2016-03-041-0/+20
|\ \
| * | [compute] Support restore serverjichenjc2016-02-231-0/+20
| | | | | | | | | | | | | | | | | | Server in soft-delete state can be restored, add this command. Change-Id: Id9d7246f89ae65273505f36dcb664996534ae986
* | | Merge "[compute] Add unit test for keypair"Jenkins2016-03-042-0/+315
|\ \ \
| * | | [compute] Add unit test for keypairjichenjc2016-02-232-0/+315
| | | | | | | | | | | | | | | | | | | | | | | | keypair do not have unit test, this patch adds it. Change-Id: Id702ccaad239b916340bb17014d1ede0a28aaec9
* | | | Merge "Add test cases to test some commands with '--wait' and fix bug"Jenkins2016-03-041-0/+188
|\ \ \ \ | |_|_|/ |/| | |
| * | | Add test cases to test some commands with '--wait' and fix bugting.wang2016-03-021-0/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "server image create" "server rebuild" "server resize" Above 3 commands are not covered by unit test. So add some unit tests. Meanwhile, fix bug. Now that image name is an optional argument, we'd better record error messages with positional arguments instead of optional argument. So, record server name. Change-Id: I41bc025d4824dc46f63a3213d82e1528bacbbe12