Commit Graph

101 Commits

Author SHA1 Message Date
2b670afa33 Refactor abstract columns and datalist out in compute test cases
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
2016-01-21 04:50:29 +00:00
aa041c5269 Merge "Make --image parameter optional in "server rebuild"" 2016-01-15 17:44:01 +00:00
401164939e Merge "Add support to list all security group rules" 2016-01-04 21:41:06 +00:00
17f3685a83 TestServerGeneral: Add test for _prep_server_detail()
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
2015-12-20 11:33:46 +08:00
b4660fec7d TestServerGeneral: Add test for _format_servers_list_networks()
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
2015-12-20 11:24:12 +08:00
5840dd5a77 Merge "TestServerGeneral: Add test for _format_servers_list_power_state()" 2015-12-17 21:09:46 +00:00
96cc5eb354 Add support to list all security group rules
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
2015-12-17 12:49:13 -06:00
c47aa52c43 Merge "Trivial: Improve unclear comments in test_server.py" 2015-12-14 22:47:35 +00:00
079123bb0b Remote security group name not displayed for rule
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
2015-12-14 14:48:19 -05:00
785caf503f Merge "Add source security group support to create rule" 2015-12-11 17:40:11 +00:00
6f7c705d4a Trivial: Improve unclear comments in test_server.py
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
2015-12-11 17:18:28 +08:00
a526777218 Make --image parameter optional in "server rebuild"
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>
2015-12-11 15:34:26 +08:00
f2339e94b0 Merge "Add unit test for TestServerList to test --long option." 2015-12-10 18:25:40 +00:00
a8ba54562b TestServerGeneral: Add test for _format_servers_list_power_state()
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
2015-12-10 17:11:41 +08:00
f65f82e435 Fix poorly named test mocks
Change-Id: I6e2911e88fc458b39d5024a5714ed8af3f519946
2015-12-09 11:59:30 -07:00
7aa6e5e36c SDK integration extensions and server create networks
Finish up the SDK integration with server create network and port
find and extension list.

Change-Id: I18dbada784d8aa92a45a937f251023ddf899c53e
2015-12-09 11:39:20 -07:00
6a5be8c4c9 Add unit test for TestServerList to test --long option.
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
2015-12-09 19:42:52 +08:00
ccbffb2ef9 Merge "Use FakeVolume in server test cases." 2015-12-09 04:14:56 +00:00
dc5bd94213 Merge "Use FakeImage in server test cases." 2015-12-09 04:14:53 +00:00
4be716eb27 Migrate network client to SDK.
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>
2015-12-09 09:30:29 +08:00
85d6aeea32 Trivial: Coding style fix in test_flavor.py
Change-Id: I3dcb3c4fbd9ff9c351426ae2ad9da009208a6485
2015-12-08 13:35:51 +08:00
ec79d338f7 Use FakeVolume in server test cases.
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
2015-12-08 10:36:25 +08:00
a4696dce1e Use FakeImage in server test cases.
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
2015-12-08 10:05:36 +08:00
566388ab1e Add source security group support to create rule
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
2015-12-07 12:42:10 -06:00
0d7be6fbcb Use formatter in server.py for "server list" tests.
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
2015-12-07 22:16:04 +08:00
d7c3048f56 Add class TestServerList to provide basic unit test for "server list" command.
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
2015-12-02 19:29:40 +08:00
d37d27b2d6 Enable setup_servers_mock() to take attributes param.
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
2015-12-02 19:27:06 +08:00
5ad7dcd899 Merge "Add unit testcases for "openstack flavor delete"" 2015-12-01 00:27:15 +00:00
e6057f088b Merge "Add project name/ID validation for "openstack quota show"" 2015-12-01 00:03:10 +00:00
cbd4f67b04 Merge "Add testcases for compute.v2.service" 2015-11-30 13:09:59 +00:00
eb8672978c Add testcases for compute.v2.service
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
2015-12-01 10:09:54 +08:00
b920245f10 Merge "Add "openstack server unshelve" into OSC" 2015-11-30 10:32:13 +00:00
0eecedc0b6 Add unit testcases for "openstack flavor delete"
Change-Id: If23a71c678193e5c9c91300fddd17e79f674bf82
2015-11-30 00:48:32 -05:00
0ccd2a8108 Add project name/ID validation for "openstack quota show"
A validation is necessary to check the existence of project.
This patch is similar to Ia2d8c96527820e25b074e6486d3f39c5ad7eae60.

Change-Id: Id8895ba7a21ecad05942619a82a87c0dc68eae53
2015-11-29 22:30:04 -05:00
d236a783d2 Remove old fake flavor data.
The new class FakeFlavor has been introduced to fake one or more flavors.
So use it and remove the old fake flavor data.

Change-Id: Ie3a33b36ae6e597c6a0b1d17ad13c73cf4b73bc9
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:52:03 +08:00
b7f62058ad Use FakeFlavor in TestServerCreate.
Change-Id: Ib82f845258b1ad78cbc8b23d28fa42e7ccc8097a
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:52:01 +08:00
c5a55d1370 User FakeFlavor in TestServerResize.
Change-Id: Iac9b4583befaa4eb79ec59c39b97c613884ef2f7
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:24:41 +08:00
db516b2c96 Use FakeFlavor in TestFlavorUnset.
Change-Id: Ifbd360db39d380efd9632300367b13283ac75f54
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:14:18 +08:00
dfbf41c55f Use FakeFlavor in TestFlavorSet.
Change-Id: I335298b07afb3f969c76748527dda06cb5393fa8
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:14:12 +08:00
8d42da5186 Use FakeFlavor in TestFlavorList.
Change-Id: I3595877bed41bc476934ca924f1f9c8c0ad79176
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:14:04 +08:00
0de260e8be Introduce class FakeFlavor to fake one or more flavors.
Change-Id: I1b20e7d50e478ce8114ca08aa455b7acad4ea7f5
Implements: blueprint improve-flavor-unit-test
2015-11-28 16:13:52 +08:00
109672fecb Refactor: Move FakeFlavorResource to compute_fakes.py.
Just like FakeServer and FakeResource, FakeFlavorResource should be in compute_fakes.py.

Change-Id: I8315256fb90377605fa2190e24c9674f6aaf6efd
Implements: blueprint improve-flavor-unit-test
2015-11-28 15:25:39 +08:00
f19ff68e59 Refactor: Abstract datalist out in TestFlavorList to avoid redundant code.
datalist has been set in each test case in TestFlavorList, which is not
necessary. This patch abstract it out and remove all redundant code.

Change-Id: I6f735f7d9fa29a8ab435adaef17ca559df1fdcee
Implements: blueprint improve-flavor-unit-test
2015-11-28 14:42:38 +08:00
f9ca752177 Refactor: Abstract columns out in TestFlavorList to avoid redundant code.
The columns has been set in each test case of TestFlavorList, which is not
necessary. This patch abstract it out and remove all redundant code.

Change-Id: Ideb2872f073755ac251bd603fd906410ea86c4ef
Implements: blueprint improve-flavor-unit-tes
2015-11-28 14:05:20 +08:00
af5dbf72c4 Add "openstack server unshelve" into OSC
The unshelve operation is not supported by OSC,
and this patch tries to add it.

Change-Id: Ic60a4616cb63ad21c1a3c8e02611da8bad3a8bd0
Implements: blueprint introduce-shelve-into-osc
2015-11-28 11:21:05 +08:00
dacd5dce28 Add unit tests for "server stop" command.
Change-Id: Idfa82f7f3aee3824aedf8b551be7942659530457
Implements: blueprint osc-unit-test-framework-improvement
2015-11-27 19:21:01 +08:00
cfff32aed6 Add unit tests for "server start" command.
Change-Id: I19060419a17b8e081e8f51c08959f24b84e7e570
Implements: blueprint osc-unit-test-framework-improvement
2015-11-27 19:20:07 +08:00
9f38df9208 Add unit tests for "server resume" command.
Change-Id: I8961e72b6901a52612cf62f52c02b6c2ff3dcd94
Implements: blueprint osc-unit-test-framework-improvement
2015-11-27 19:19:04 +08:00
c176987063 Add unit tests for "server suspend" command.
Change-Id: Idfdd98fd27d97e1216abe9b14d3dea7c8f2a5a68
Implements: blueprint osc-unit-test-framework-improvement
2015-11-27 19:17:27 +08:00
4062d59965 Add unit tests for "server unlock" command.
Change-Id: I4fbf115f925a6ffdeaec3d856d22224fa7730729
Implements: blueprint osc-unit-test-framework-improvement
2015-11-27 19:14:47 +08:00