Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for force detach volume
V2 volumes_client in Tempest doesn't contain volume action: force detach volume. This patch adds the support. Including: [1] Add force detach volume api to v2 volumes client [2] Add release notes [3] Add unit test for force detach volume api [3] Add test case: test_force_detach_volume Change-Id: I172913b7d372225328a3c30299926c599c7d245a
- Loading branch information
1 parent
3f06f4b
commit 7b0eaf8
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/add-force-detach-volume-to-volumes-client-library-b2071f2954f8e8b1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
features: | ||
- | | ||
Add force detach volume feature API to v2 volumes_client library. | ||
This feature enables the possibility to force a volume to detach, and | ||
roll back an unsuccessful detach operation after you disconnect the volume. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
tempest/tests/lib/services/volume/v2/test_volumes_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD | ||
# All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from tempest.lib.services.volume.v2 import volumes_client | ||
from tempest.tests.lib import fake_auth_provider | ||
from tempest.tests.lib.services import base | ||
|
||
|
||
class TestVolumesClient(base.BaseServiceTest): | ||
|
||
def setUp(self): | ||
super(TestVolumesClient, self).setUp() | ||
fake_auth = fake_auth_provider.FakeAuthProvider() | ||
self.client = volumes_client.VolumesClient(fake_auth, | ||
'volume', | ||
'regionOne') | ||
|
||
def _test_force_detach_volume(self, bytes_body=False): | ||
kwargs = { | ||
'attachment_id': '6980e295-920f-412e-b189-05c50d605acd', | ||
'connector': { | ||
'initiator': 'iqn.2017-04.org.fake:01' | ||
} | ||
} | ||
|
||
self.check_service_client_function( | ||
self.client.force_detach_volume, | ||
'tempest.lib.common.rest_client.RestClient.post', | ||
{}, | ||
to_utf=bytes_body, | ||
status=202, | ||
volume_id="a3be971b-8de5-4bdf-bdb8-3d8eb0fb69f8", | ||
**kwargs | ||
) | ||
|
||
def test_force_detach_volume_with_str_body(self): | ||
self._test_force_detach_volume() | ||
|
||
def test_force_detach_volume_with_bytes_body(self): | ||
self._test_force_detach_volume(bytes_body=True) |