summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute/v2
Commit message (Collapse)AuthorAgeFilesLines
* Refactor security group list to use SDKRichard Theis2016-02-292-62/+64
| | | | | | | | | | | | | | | | | | | | Refactored the 'os security group list' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. This refactor also removes the logic for displaying project names instead of project IDs when the --all-projects option is specified. This logic was removed because it is inconsistent with the other network commands. Since neutron will always display security groups across all projects for an admin, the --all-projects option is now hidden when neutron is enabled and the Project column is always displayed. Change-Id: I934a1f5084ef3c5f929d0ffd38ebf5064d799941 Partial-Bug: #1519511 Related-to: blueprint neutron-client
* Merge "Make SetFlavor and UnsetFlavor inherit from cliff.Command"Jenkins2016-02-291-10/+4
|\
| * Make SetFlavor and UnsetFlavor inherit from cliff.CommandTang Chen2016-02-271-10/+4
| | | | | | | | | | | | set/unset comamnd classes should inherit from cliff.Command class. Change-Id: I54e5608ac0768d7d94b7f7d516ea1948daefdc1b Partial-Bug: 1546065
* | [Compute] Check return value is None in compute unit tests.Tang Chen2016-02-273-45/+33
|/ | | | | | | | | take_action() in commands inheriting from Command returns nothing. So we should assert the return is None in the unit tests of these commands. Change-Id: I953480ecff3b5beb12255d866d0e1df45f130efd Partial-Bug: #1550636
* Merge "Floating IP: Neutron support for "ip floating show" command"Jenkins2016-02-251-0/+1
|\
| * Floating IP: Neutron support for "ip floating show" commandTang Chen2016-02-241-0/+1
| | | | | | | | | | | | Change-Id: I30350076621c83c758927444e5f8bcc2b7d0fc74 Partial-Bug: 1519502 Related-to: blueprint neutron-client
* | Merge "Fixed a bunch of spacing"Jenkins2016-02-251-0/+2
|\ \
| * | Fixed a bunch of spacingBrandon Palm2016-02-231-0/+2
| |/ | | | | | | | | | | | | Nothing too complicated here. I fixed a bunch of spacing issues that I saw in OSC. Change-Id: I935ab48e7c5bac5f88ecdb3a05f73fb44fc9f41d
* | Add some test cases for "server list" commandting.wang2016-02-242-27/+78
|/ | | | | | | | Add some test cases that test 'server list' command when specifying flavor or image. Because I add some attribution to fake.py, I have to change some code in create server test. Despite all this, I think it's good for testing. Change-Id: I714deac1f6f940b790a3c20af5f7ffa724ac44d1
* Merge "Add unit tests for 'hypervisor stats' command"Jenkins2016-02-232-0/+140
|\
| * Add unit tests for 'hypervisor stats' commandting.wang2016-02-222-0/+140
| | | | | | | | | | | | | | 'hypervisor stats show' command isn't covered by unit tests, so add unit tests to test it. Change-Id: Ic355230cbdd596e848191b599803dca7f27c2ffb
* | Initialize _keys in __init__() in FakeFlavorResourceTang Chen2016-02-231-2/+5
|/ | | | | | | | | | | _keys is defined as a class attribute in FakeFlavorResource. So when we call set_keys() to update it, it changes. And this change may bring trouble to the other tests afterward. So define and initialize it in __init__() as an object attribute. Change-Id: Ib18c03877b67e1b7c2e107f598076b928a58e4fb Closes-bug: #1548378
* Add unit test for "flavor show" commandTang Chen2016-02-202-10/+89
| | | | Change-Id: I1591649e5b97a885707042fcccad3335ee8c7aec
* Merge "Support "network show" command in nova network"Jenkins2016-02-181-2/+31
|\
| * Support "network show" command in nova networkTang Chen2016-02-171-2/+31
| | | | | | | | | | | | | | | | "network show" command is not implemented in nova network. This patch implements it. Change-Id: I1fadd890fe36c4e3ac5c9ed389b20c5b2fff8aca partial-Bug: 1543672
* | Merge "Support "network list" command in nova network"Jenkins2016-02-181-0/+58
|\ \ | |/
| * Support "network list" command in nova networkTang Chen2016-02-171-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "network list" command is not implemented in nova network. This patch implements it. The Network object in novaclient is quite different from the one in sdk. And the output of "network list" using Nova network is also quite different from using Neutron. It is like this: # openstack network list +--------------------------------------+---------+-------------+ | ID | Name | Subnet | +--------------------------------------+---------+-------------+ | 96a98ec4-31f6-45f6-99e6-9384569b3bb5 | private | 10.0.0.0/24 | +--------------------------------------+---------+-------------+ --long and --external options have not been implemented because the attrs in Network object in novaclient is too much different. This patch also introduces a new FakeNetwork class in compute/v2/fake.py to fake nova network. Change-Id: Id1fdf81fb2fa8b39f2c76b7bae37ac4fecafd0f7 Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e partial-Bug: 1543672
* | Merge "Refactor security group rule delete to use SDK"Jenkins2016-02-181-0/+62
|\ \ | |/ |/|
| * Refactor security group rule delete to use SDKRichard Theis2016-02-101-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactored the 'os security group rule delete' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. This patch set also introduces new FakeSecurityGroupRule classes for testing network and compute security group rules. And fixes were made to the network FakeSecurityGroup class. Change-Id: I8d0917925aa464e8255defae95a2a2adfb6cfb75 Partial-Bug: #1519512 Related-to: blueprint neutron-client
* | Define FakeFloatingIP class in tests/compute for nova network commandsTang Chen2016-02-161-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "ip floating list" command is not available for Neutron now because the implementation is incorrect. The FloatingIP objects returned from Nova and Neutron network are quite different. So they need different FakeFloatingIP class to do the tests. This patch copies class FakeFloatingIP in tests/network to tests/compute for Nova network tests. Will fix the problem in "ip floating list" command and change FakeFloatingIP in tests/network to fit Neutron network tests. Change-Id: Ia29d257868e0f1dc6cd7cfe3819875e5913f76ec Partial-Bug: 1519502 Partially implements: blueprint neutron-client
* | Merge "Use assertRaises() to check if an exception is raised"Jenkins2016-02-151-5/+4
|\ \
| * | Use assertRaises() to check if an exception is raisedTang Chen2016-02-141-5/+4
| | | | | | | | | | | | | | | | | | | | | In some test cases, try/except is used to check if an exception has been raised. We should use assertRaises() instead. Change-Id: I15c8e757dcab77fd6f895feb018184e1eb7e617b
* | | Support "network delete" command in nova networkTang Chen2016-02-141-0/+4
|/ / | | | | | | | | | | | | | | | | "network delete" command is not implemented in nova network. This patch implements it. Change-Id: I5dac1eed6eb8e67298bb446418835a6ab85c859c Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e partial-Bug: 1543672
* | Floating IP: Neutron support for "ip floating delete" commandJude Job2016-02-141-0/+3
| | | | | | | | | | | | | | | | | | | | This patch implements "ip floating delete" command for both compute and network. Also includes unit tests. Change-Id: Ie61f0faad65ec90f9d9956ae463412be8d963d05 partial-Bug: 1519502 Related-to: blueprint neutron-client Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
* | Trivial: Fix "abstractmethod" to "abstract method"Tang Chen2016-02-106-24/+24
|/ | | | | | | | | As Richard <rtheis@us.ibm.com> has pointed out, "abstractmethod" should be "abstract method". This is a small typo I have made when I fix DisplayCommandBase comment bug. Change-Id: I84f1a3158896257686a0a7efa1123eef1b85139f Partial-bug: #1477199
* Merge "Compute: Fix DisplayCommandBase comments for cliff ShowOne subclass ↵Jenkins2016-02-083-12/+36
|\ | | | | | | tests"
| * Compute: Fix DisplayCommandBase comments for cliff ShowOne subclass testsTang Chen2016-02-063-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As bug #1477199 describes, the wrong comment below is all over the unit test code of OSC. # DisplayCommandBase.take_action() returns two tuples There is no such class named DisplayCommandBase in OSC. It is in cliff. All OSC command classes inherit from the base classes in cliff, class Command, class Lister and class ShowOne. It is like this: Object |--> Command |--> DisplayCommandBase |--> Lister |--> ShowOne take_action() is an abstract method of class Command, and generally is overwritten by subclasses. * Command.take_action() returns nothing. * Lister.take_action() returns a tuple which contains a tuple of columns and a generator used to generate the data. * ShowOne.take_action() returns an iterator which contains a tuple of columns and a tuple of data So, this problem should be fixed in 3 steps: 1. Remove all DisplayCommandBase comments for tests of classes inheriting from class Command in cliff as it returns nothing. 2. Fix all DisplayCommandBase comments for tests of classes inheriting from class Lister in cliff. Lister.take_action() returns a tuple and a generator. 3. Fix all DisplayCommandBase comments for tests of classes inheriting from class ShowOne in cliff. ShowOne.take_action() returns two tuples. This patch finishes step 3 in compute tests. Change-Id: I4df224ec82b5d82a3d6d3f366c0f68a7ea0d87cd Partial-bug: #1477199
* | Merge "Compute: Fix DisplayCommandBase comments for cliff Lister subclass tests"Jenkins2016-02-084-9/+27
|\ \ | |/
| * Compute: Fix DisplayCommandBase comments for cliff Lister subclass testsTang Chen2016-02-064-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As bug #1477199 describes, the wrong comment below is all over the unit test code of OSC. # DisplayCommandBase.take_action() returns two tuples There is no such class named DisplayCommandBase in OSC. It is in cliff. All OSC command classes inherit from the base classes in cliff, class Command, class Lister and class ShowOne. It is like this: Object |--> Command |--> DisplayCommandBase |--> Lister |--> ShowOne take_action() is an abstract method of class Command, and generally is overwritten by subclasses. * Command.take_action() returns nothing. * Lister.take_action() returns a tuple which contains a tuple of columns and a generator used to generate the data. * ShowOne.take_action() returns an iterator which contains a tuple of columns and a tuple of data So, this problem should be fixed in 3 steps: 1. Remove all DisplayCommandBase comments for tests of classes inheriting from class Command in cliff as it returns nothing. 2. Fix all DisplayCommandBase comments for tests of classes inheriting from class Lister in cliff. Lister.take_action() returns a tuple and a generator. 3. Fix all DisplayCommandBase comments for tests of classes inheriting from class ShowOne in cliff. ShowOne.take_action() returns two tuples. This patch finishes step 2 in compute tests. Change-Id: Idc54ad21eaa1371ebd601327b8d962c7039f2de0 Partial-bug: #1477199
* | Merge "Compute: Fix DisplayCommandBase comments for cliff Command subclass ↵Jenkins2016-02-082-10/+0
|\ \ | |/ | | | | tests"
| * Compute: Fix DisplayCommandBase comments for cliff Command subclass testsTang Chen2016-02-062-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As bug #1477199 describes, the wrong comment below is all over the unit test code of OSC. # DisplayCommandBase.take_action() returns two tuples There is no such class named DisplayCommandBase in OSC. It is in cliff. All OSC command classes inherit from the base classes in cliff, class Command, class Lister and class ShowOne. It is like this: Object |--> Command |--> DisplayCommandBase |--> Lister |--> ShowOne take_action() is an abstract method of class Command, and generally is overwritten by subclasses. * Command.take_action() returns nothing. * Lister.take_action() returns a tuple which contains a tuple of columns and a generator used to generate the data. * ShowOne.take_action() returns an iterator which contains a tuple of columns and a tuple of data So, this problem should be fixed in 3 steps: 1. Remove all DisplayCommandBase comments for tests of classes inheriting from class Command in cliff as it returns nothing. 2. Fix all DisplayCommandBase comments for tests of classes inheriting from class Lister in cliff. Lister.take_action() returns a tuple and a generator. 3. Fix all DisplayCommandBase comments for tests of classes inheriting from class ShowOne in cliff. ShowOne.take_action() returns two tuples. This patch finishes step 1 in compute tests. Change-Id: I99ab42a7de69af0e5de802a1bb5aac647245a200 Partial-bug: #1477199
* | Merge "Add unit tests for "hypervisor show" command"Jenkins2016-02-082-0/+131
|\ \
| * | Add unit tests for "hypervisor show" commandTang Chen2016-02-072-0/+131
| |/ | | | | | | Change-Id: Ib75e5eb5b197e9d58fb87a595a43b8774b7b1987
* | Remove identity_client.projects definition in TestSecurityGroupTang Chen2016-02-061-4/+2
| | | | | | | | | | | | | | | | projects mock has been defined in FakeIdentityv2Client as tenants, and in FakeIdentityv3Client as projects. No need to define them again. Change-Id: Ieb97b32d7be6bd95c8621092b218ebfd8bc5b78d
* | Define security_group_rules mock in FakeComputev2ClientTang Chen2016-02-062-5/+6
| | | | | | | | | | | | | | security_group_rules mock should be defined in FakeComputev2Client, and used in each test class. Change-Id: I44bb6379b2c1b6cb277296e08e25dd4d7255c276
* | Move security_groups mock definition to FakeComputev2ClientTang Chen2016-02-063-6/+18
|/ | | | | | All compute client related mocks should be defined in FakeComputev2Client. Change-Id: Ie75385af772ca23286c4cf131d3d54cc14f20a30
* Merge "Add support for triggering an crash dump"Jenkins2016-02-051-0/+20
|\
| * Add support for triggering an crash dumpxiexs2016-02-051-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | The triggering crash dump feature is supported by nova [1] and novaclient [2] now, it's time to introduce this feature into OSC correspondingly. [1]The change id is: I6ed777ff637254b4b79417008f9055dd19fc7405 [2]The change id is: If03b1864bbe7074c720b946fc2700bd5d07debc3 Change-Id: I5a411f283fdf0fc3c00380d069848a332c799cdd Closes-Bug: #1538372 Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
* | Add unit tests for "hypervisor list" commandTang Chen2016-02-052-0/+160
|/ | | | | | | | | | | There is no unit tests for "hypervisor" command. This patch introudces a new class FakeHypervisor to fake one or more hypervisors, and a base class TestHypervisor. Also adds hypervisors mock to fake compute client. And also, this patch adds unit tests for "hypervisor list" command. Change-Id: I18733eae1a8f4fff72e830d9a060fb8f0f58fbf5
* Merge "Refactor "os availability zone list""Jenkins2016-01-221-0/+62
|\
| * Refactor "os availability zone list"Richard Theis2016-01-141-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | Refactor the "os availability zone list" command to make it a common command instead of a compute-only command. Since availability zones are common to compute, volume and network (new), this refactoring allows availability zone support to be added for volume and network. In addition to the refactor, unit and functional tests were added. Change-Id: I63e9d41d229b21cd38e5a083493042c096d65e05 Partial-Bug: #1532945
* | Refactor abstract columns and datalist out in compute test casesSaiKiran2016-01-213-167/+83
| | | | | | | | | | | | | | | | | | columns and datalist has been set in each test case in compute, which is not necessary. This patch abstract it out and remove all redundant code. Change-Id: I5e8423722416ea31fdced4c932ed141de90028ab Closes-Bug: #1531816
* | Merge "Make --image parameter optional in "server rebuild""Jenkins2016-01-151-0/+70
|\ \ | |/ |/|
| * Make --image parameter optional in "server rebuild"David Moreau Simard2015-12-111-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | The command will now default to the image currently in-use by the server, effectively making the --image parameter optional. This commit also adds basic tests for ServerRebuild since there wasn't any. Will add more full tests for it. Change-Id: I733fd3ad5a825f06563c72aa430122e1a0e3b3b0 Closes-bug: #1524406 Co-Authored-By: David Moreau Simard <dms@redhat.com> Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
* | Merge "Add support to list all security group rules"Jenkins2016-01-041-4/+82
|\ \
| * | Add support to list all security group rulesRichard Theis2015-12-171-4/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both nova and neutron allow security group rules to be listed without specifying the owning security group. This patch set makes the group argument on 'os security group rule list' optional. Behavior is unchanged when the argument is specified. When the argument is not specified then all accessible security group rules will be listed. The listing will include the owning security group for each rule. Change-Id: I6914baecf70a65354e1e82dad92c6afbd32b4973 Related-Bug: #1519512
* | | TestServerGeneral: Add test for _prep_server_detail()Tang Chen2015-12-201-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Make TestServerGeneral inherit from TestServer because we need to use servers_mock, image_mock and flavor_mock in compute_client. 2. Create a dict containing all info of a server in the original format, and pass it to _prep_server_detail(). 3. Compare the original and formatted dict. Change-Id: Ie0b83c42a5c3bbba630a064d28374d07e2ce9caf Implements: blueprint osc-unit-test-framework-improvement
* | | TestServerGeneral: Add test for _format_servers_list_networks()Tang Chen2015-12-201-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | The items in a dict are in random order. So if a server is in two networks, there may be two results after formatted. Change-Id: I2e15d202639e3fff427935f46650a405b0e51bcc Implements: blueprint osc-unit-test-framework-improvement
* | | Merge "TestServerGeneral: Add test for _format_servers_list_power_state()"Jenkins2015-12-171-0/+20
|\ \ \ | |/ / |/| |
| * | TestServerGeneral: Add test for _format_servers_list_power_state()Tang Chen2015-12-101-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | If we have tests for each helper function, then we can call them in other tests without worrying about error. Change-Id: I1e4273aef201fe9d8936e5c365ebb46068039892 Implements: blueprint osc-unit-test-framework-improvement