summaryrefslogtreecommitdiff
path: root/openstackclient/tests/compute
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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
* | | Merge "Trivial: Improve unclear comments in test_server.py"Jenkins2015-12-141-5/+5
|\ \ \
| * | | Trivial: Improve unclear comments in test_server.pyTang Chen2015-12-111-5/+5
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | In test_server.py, there are two ImageManagers are faked: 1. the one in compute client 2. the one in image client But the comments are the same. And so is volume. This patch makes the comments more clear. Change-Id: I2c52f48a7b3c005c185a4ac64abbb3e18d5fb3de
* | | Remote security group name not displayed for ruleRichard Theis2015-12-141-18/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'security group rule list' command was updated to display the remote security group name for a security group rule. This was done via a new 'Remote Security Group' column. The output of the 'security group rule create' and 'security group show' commands was also updated to include 'remote_security_group' information instead of the raw 'group' information returned from the API layer. Change-Id: I5f9600338c8331966d2c658109a24b502c538106 Closes-Bug: #1520003
* | | Merge "Add source security group support to create rule"Jenkins2015-12-111-14/+40
|\ \ \
| * | | Add source security group support to create ruleRichard Theis2015-12-071-14/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'security group rule create' command was updated to support a source security group. Now either a source IP address block or source security group can be specified when creating a rule. The default remains the same. Change-Id: If57de2871810caddeeaee96482eb34146968e173 Closes-Bug: #1522969
* | | | Merge "Add unit test for TestServerList to test --long option."Jenkins2015-12-101-5/+50
|\ \ \ \ | |_|/ / |/| | |
| * | | Add unit test for TestServerList to test --long option.Tang Chen2015-12-091-5/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In two steps: 1. Setup all necessary attributes of a server in setUp(), including the ones that are not faked in FaseServer by default. 2. Run a similar process with no option test case. The future plan is to move all these attributes to FakeServer. But it will cause some other changes which has nothing to do with this patch. So leave this job to do later. Change-Id: I1134812a0ea146ef737b0f0ffbef8ca23684accd Implements: blueprint osc-unit-test-framework-improvement
* | | | Fix poorly named test mocksTerry Howe2015-12-091-6/+6
| | | | | | | | | | | | | | | | Change-Id: I6e2911e88fc458b39d5024a5714ed8af3f519946
* | | | SDK integration extensions and server create networksTerry Howe2015-12-091-6/+11
| |_|/ |/| | | | | | | | | | | | | | | | | Finish up the SDK integration with server create network and port find and extension list. Change-Id: I18dbada784d8aa92a45a937f251023ddf899c53e
* | | Merge "Use FakeVolume in server test cases."Jenkins2015-12-092-14/+7
|\ \ \
| * | | Use FakeVolume in server test cases.Tang Chen2015-12-082-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a class FakeVolume to fake one or more volumes. So use it in test_server.py. Change-Id: I735ae7f678a6799e0ae4c7c25c8083d9ebf47b09 Implements: blueprint improve-volume-unittest-framework
* | | | Merge "Use FakeImage in server test cases."Jenkins2015-12-091-24/+16
|\ \ \ \ | |/ / /
| * | | Use FakeImage in server test cases.Tang Chen2015-12-081-24/+16
| | |/ | |/| | | | | | | | | | | | | | | | | | | We have a class FakeImage to fake one or more images. So use it in test_server.py. Change-Id: I276e4ade5aecefbe66b9722c1dfbac10b3bd14b6 Implements: blueprint improve-image-unittest-framework
* | | Migrate network client to SDK.Tang Chen2015-12-091-0/+12
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous patches have migrate all network commands to the new version using sdk. This patch will remove the temporary method, and implement a new make_client() to create sdk network client. And also, find() in openstackclient/network/common.py must support sdk. The logic of this function will become much easier than before, so this patch also removes two useless test cases of find(). This patch will also remove the patched methods in tests. Change-Id: Ic2f7bca073beb9757172d16f95d9b82c48cbbc12 Implements: blueprint neutron-client Co-Authored-By: Terry Howe <terrylhowe@gmail.com> Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
* | Trivial: Coding style fix in test_flavor.pyTang Chen2015-12-081-4/+4
| | | | | | | | Change-Id: I3dcb3c4fbd9ff9c351426ae2ad9da009208a6485
* | Use formatter in server.py for "server list" tests.Tang Chen2015-12-071-1/+1
|/ | | | | | | | | | | We should use the formatter in the original code to set the expected data in each test case. The same problem exists in other test cases, like "server create". But data structure in TestServerCreate is different from TestServerList, so will fix the problem in another patch. Change-Id: I233f7a91cd4cc1e996941e26ea85490fa3290572
* Add class TestServerList to provide basic unit test for "server list" command.Tang Chen2015-12-021-0/+81
| | | | | | | | | | | | This patch provide a class to test "server list" command. Only one simplest case in this patch. Some of the options in "server list" are complicated. And the server object contains lots of attributes need to be handled in specific ways. So other test cases will be added in other patches. Change-Id: Id9fdba8f149bd74187aa42516067dacebc6962b5 Implements: blueprint osc-unit-test-framework-improvement
* Enable setup_servers_mock() to take attributes param.Tang Chen2015-12-021-1/+5
| | | | | | | | | | setup_servers_mock() is now able to set methods to the fake servers. But it cannot set attributes. This patch enable it to do so. This will be useful in "server list" test cases. Change-Id: Ic30d750ebe4650244707a368cdd5d622a8f1b8ed Implements: blueprint osc-unit-test-framework-improvement
* Merge "Add unit testcases for "openstack flavor delete""Jenkins2015-12-011-0/+46
|\
| * Add unit testcases for "openstack flavor delete"xiexs2015-11-301-0/+46
| | | | | | | | Change-Id: If23a71c678193e5c9c91300fddd17e79f674bf82
* | Merge "Add project name/ID validation for "openstack quota show""Jenkins2015-12-011-0/+2
|\ \
| * | Add project name/ID validation for "openstack quota show"xiexs2015-11-291-0/+2
| |/ | | | | | | | | | | | | A validation is necessary to check the existence of project. This patch is similar to Ia2d8c96527820e25b074e6486d3f39c5ad7eae60. Change-Id: Id8895ba7a21ecad05942619a82a87c0dc68eae53
* | Merge "Add testcases for compute.v2.service"Jenkins2015-11-302-5/+109
|\ \
| * | Add testcases for compute.v2.servicexiexs2015-12-012-5/+109
| |/ | | | | | | | | | | | | | | | | Add a set of testcases to test the classes of ListService and SetService in the compute.v2.service. And to be consistent with cinder term, use service_binary to represent the service binary. Change-Id: I9fe740f07c9ce3afdba7b7cca152d614170abb96