Merge "Automate generation of volume transfer api-ref samples"
This commit is contained in:
commit
c191432232
@ -0,0 +1,6 @@
|
||||
{
|
||||
"transfer": {
|
||||
"volume_id": "1bb4acc9-9fa4-4b4d-8992-3259b69c8372",
|
||||
"name": "first volume"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"transfer": {
|
||||
"auth_key": "19244092a5352ebb",
|
||||
"created_at": "2023-06-12T21:21:38.394873",
|
||||
"id": "33907fea-976f-4d67-8867-b5382f84eb8c",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://127.0.0.1:45183/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/33907fea-976f-4d67-8867-b5382f84eb8c",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://127.0.0.1:45183/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/33907fea-976f-4d67-8867-b5382f84eb8c",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"no_snapshots": false,
|
||||
"volume_id": "31024287-e368-4b2c-85a4-880b3b6fc8b0"
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"transfer": {
|
||||
"created_at": "2023-06-22T08:28:14.618343",
|
||||
"id": "16b47e50-ab70-4781-bc01-cdcc01ca264a",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://127.0.0.1:38399/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/16b47e50-ab70-4781-bc01-cdcc01ca264a",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://127.0.0.1:38399/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/16b47e50-ab70-4781-bc01-cdcc01ca264a",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"no_snapshots": false,
|
||||
"volume_id": "a67e4027-4a83-4b80-a2d5-5b49650ac28c"
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"transfer": {
|
||||
"volume_id": "80d68197-b67e-4c8e-bbb9-030b2581f921",
|
||||
"name": "first volume",
|
||||
"no_snapshots": false
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"transfer": {
|
||||
"accepted": false,
|
||||
"auth_key": "e2cb02466324813c",
|
||||
"created_at": "2023-06-12T21:21:38.392033",
|
||||
"destination_project_id": null,
|
||||
"id": "94bae1a0-83fb-496c-9cd2-800d8237ab0d",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://127.0.0.1:45193/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/94bae1a0-83fb-496c-9cd2-800d8237ab0d",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://127.0.0.1:45193/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/94bae1a0-83fb-496c-9cd2-800d8237ab0d",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"no_snapshots": false,
|
||||
"source_project_id": "89afd400-b646-4bbc-b12b-c0a4d63e5bd3",
|
||||
"volume_id": "202eead8-3c82-41e1-914f-83638a063be9"
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"transfer": {
|
||||
"accepted": false,
|
||||
"created_at": "2023-06-22T08:28:17.647081",
|
||||
"destination_project_id": null,
|
||||
"id": "3d79fbda-8d9c-4da3-a016-e5612fcb7f65",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://127.0.0.1:34593/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/3d79fbda-8d9c-4da3-a016-e5612fcb7f65",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://127.0.0.1:34593/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/3d79fbda-8d9c-4da3-a016-e5612fcb7f65",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"no_snapshots": false,
|
||||
"source_project_id": "89afd400-b646-4bbc-b12b-c0a4d63e5bd3",
|
||||
"volume_id": "7e31e409-2a7a-4ea6-aa0b-bc7be056fc57"
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"accept": {
|
||||
"auth_key": "f318375a4400391e"
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"transfer": {
|
||||
"id": "9e395d6d-5138-423c-a63c-7b62c6265fa1",
|
||||
"links": [
|
||||
{
|
||||
"href": "http://127.0.0.1:39369/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/9e395d6d-5138-423c-a63c-7b62c6265fa1",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "http://127.0.0.1:39369/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/os-volume-transfer/9e395d6d-5138-423c-a63c-7b62c6265fa1",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "8d19f929-f1da-4a76-acad-9ed17da0981e"
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@ Request
|
||||
Request Example
|
||||
---------------
|
||||
|
||||
.. literalinclude:: ./samples/volume_transfer/volume-transfer-accept-request.json
|
||||
.. literalinclude:: ./samples/volume_transfers/volume-transfers-accept-request.json
|
||||
:language: javascript
|
||||
|
||||
Response Parameters
|
||||
@ -55,7 +55,7 @@ Response Parameters
|
||||
Response Example
|
||||
----------------
|
||||
|
||||
.. literalinclude:: ./samples/volume_transfer/volume-transfer-accept-response.json
|
||||
.. literalinclude:: ./samples/volume_transfers/volume-transfers-accept-response.json
|
||||
:language: javascript
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ Request
|
||||
Request Example
|
||||
---------------
|
||||
|
||||
.. literalinclude:: ./samples/volume_transfer/volume-transfer-create-request.json
|
||||
.. literalinclude:: ./samples/volume_transfers/v3.57/volume-transfers-create-request.json
|
||||
:language: javascript
|
||||
|
||||
|
||||
@ -117,11 +117,12 @@ Response Parameters
|
||||
- destination_project_id: destination_project_id
|
||||
- source_project_id: source_project_id
|
||||
- accepted: accepted
|
||||
- no_snapshots: no_snapshots
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
|
||||
.. literalinclude:: ./samples/volume_transfer/volume-transfer-create-response.json
|
||||
.. literalinclude:: ./samples/volume_transfers/v3.57/volume-transfers-create-response.json
|
||||
:language: javascript
|
||||
|
||||
|
||||
@ -209,12 +210,13 @@ Response Parameters
|
||||
- destination_project_id: destination_project_id
|
||||
- source_project_id: source_project_id
|
||||
- accepted: accepted
|
||||
- no_snapshots: no_snapshots
|
||||
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
|
||||
.. literalinclude:: ./samples/volume_transfer/volume-transfer-show-response.json
|
||||
.. literalinclude:: ./samples/volume_transfers/v3.57/volume-transfers-show-response.json
|
||||
:language: javascript
|
||||
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"transfer": {
|
||||
"volume_id": "%(volume_id)s",
|
||||
"name": "first volume"
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"transfer": {
|
||||
"auth_key": "%(auth_key)s",
|
||||
"created_at": "%(strtime)s",
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "%(uuid)s",
|
||||
"no_snapshots": false
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"transfer": {
|
||||
"created_at": "%(strtime)s",
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "%(uuid)s",
|
||||
"no_snapshots": false
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"transfer": {
|
||||
"volume_id": "%(volume_id)s",
|
||||
"name": "first volume",
|
||||
"no_snapshots": false
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"transfer": {
|
||||
"auth_key": "%(auth_key)s",
|
||||
"created_at": "%(strtime)s",
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "%(uuid)s",
|
||||
"no_snapshots": false,
|
||||
"destination_project_id": null,
|
||||
"source_project_id": "%(uuid)s",
|
||||
"accepted": false
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"transfer": {
|
||||
"created_at": "%(strtime)s",
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "%(uuid)s",
|
||||
"destination_project_id": null,
|
||||
"source_project_id": "%(uuid)s",
|
||||
"accepted": false,
|
||||
"no_snapshots": false
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"accept": {
|
||||
"auth_key": "%(auth_key)s"
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"transfer": {
|
||||
"id": "%(uuid)s",
|
||||
"links": [
|
||||
{
|
||||
"href": "%(host)s/v3/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "self"
|
||||
},
|
||||
{
|
||||
"href": "%(host)s/%(uuid)s/os-volume-transfer/%(uuid)s",
|
||||
"rel": "bookmark"
|
||||
}
|
||||
],
|
||||
"name": "first volume",
|
||||
"volume_id": "%(uuid)s"
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
# 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 oslo_serialization import jsonutils
|
||||
|
||||
from cinder.api import microversions as mv
|
||||
from cinder.tests.functional.api_sample_tests import test_volumes
|
||||
from cinder.tests.functional import api_samples_test_base as test_base
|
||||
|
||||
|
||||
@test_base.VolumesSampleBase.use_versions(
|
||||
mv.TRANSFER_WITH_SNAPSHOTS,
|
||||
mv.TRANSFER_WITH_HISTORY)
|
||||
class VolumeTransfersSampleJsonTest(test_volumes.test_base.VolumesSampleBase):
|
||||
sample_dir = "volume_transfers"
|
||||
|
||||
def setUp(self):
|
||||
super(VolumeTransfersSampleJsonTest, self).setUp()
|
||||
res = self._create_volume()
|
||||
res = jsonutils.loads(res.content)['volume']
|
||||
self._poll_volume_while(res['id'], ['creating'])
|
||||
self.subs = {
|
||||
"volume_id": res['id']
|
||||
}
|
||||
|
||||
def _create_transfers(self, subs=None):
|
||||
response = self._do_post('volume-transfers',
|
||||
'volume-transfers-create-request',
|
||||
self.subs)
|
||||
return response
|
||||
|
||||
def test_create_transfers(self):
|
||||
response = self._create_transfers(self.subs)
|
||||
self._verify_response('volume-transfers-create-response',
|
||||
{}, response, 202)
|
||||
|
||||
def test_accept_transfer(self):
|
||||
response = self._create_transfers(self.subs)
|
||||
res = jsonutils.loads(response.content)['transfer']
|
||||
subs = {
|
||||
'auth_key': res['auth_key']
|
||||
}
|
||||
with self.common_api_sample():
|
||||
response = self._do_post('volume-transfers/%s/accept' % res['id'],
|
||||
'volume-transfers-accept-request',
|
||||
subs)
|
||||
self._verify_response('volume-transfers-accept-response',
|
||||
{}, response, 202)
|
||||
|
||||
def test_show_transfer(self):
|
||||
response = self._create_transfers(self.subs)
|
||||
res = jsonutils.loads(response.content)['transfer']
|
||||
show_response = self._do_get('volume-transfers/%s' % res['id'])
|
||||
self._verify_response('volume-transfers-show-response', {},
|
||||
show_response, 200)
|
||||
|
||||
def test_delete_transfer(self):
|
||||
response = self._create_transfers(self.subs)
|
||||
res = jsonutils.loads(response.content)['transfer']
|
||||
delete_res = self._do_delete('volume-transfers/%s' % res['id'])
|
||||
self.assertEqual(202, delete_res.status_code)
|
Loading…
Reference in New Issue
Block a user