diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index c75aabee2..dce570d3e 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -84,11 +84,12 @@ jobs: echo OS_FLAVOR=1 echo OS_DOMAIN_ID=default } >> "$GITHUB_ENV" - - name: Execute Block Storage tests + - name: Execute Block Storage v2 tests if: matrix.block_storage_v2 == true - run: php ./tests/integration/run.php -s=BlockStorage + run: php ./tests/integration/run.php -s=BlockStorage -v=v2 + - name: Execute Block Storage v3 tests + run: php ./tests/integration/run.php -s=BlockStorage -v=v3 - name: Execute Compute tests - if: matrix.block_storage_v2 == true run: php ./tests/integration/run.php -s=Compute - name: Execute Identity tests run: php ./tests/integration/run.php -s=Identity diff --git a/COVERAGE.md b/COVERAGE.md index 84160fe9c..7957e324e 100644 --- a/COVERAGE.md +++ b/COVERAGE.md @@ -1,22 +1,23 @@ # OpenStack services coverage -|Name|PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation| -|---|:--:|:--:|:--:|:--:|:--:|:--:| -|Block Storage v2|✓|✓|✓|✓|✓|✓| -|Compute v2|✓|✓|✓|✓|✓|✓| -|Compute v2 exts||||||| -|Data Processing v1||||||| -|Database v1||||||| -|Identity v2|✓|✓|✓|||| -|Identity v2 exts||||||| -|Identity v3|✓|✓|✓|✓|✓|✓| -|Identity v3 exts||||||| -|Images v2|✓|✓|✓|✓|✓|✓| -|Networking v2|✓|✓|✓|✓|✓|✓| -|Networking v2 exts||||||| -|Object Storage v1|✓|✓|✓|✓|✓|✓| -|Orchestration v1||||||| -|Telemetry v2||||||| +| Name |PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation| +|--------------------|:--:|:--:|:--:|:--:|:--:|:--:| +| Block Storage v2 |✓|✓|✓||✓|| +| Block Storage v3 |✓|✓|✓|✓|✓|✓| +| Compute v2 |✓|✓|✓|✓|✓|✓| +| Compute v2 exts ||||||| +| Data Processing v1 ||||||| +| Database v1 ||||||| +| Identity v2 |✓|✓|✓|||| +| Identity v2 exts ||||||| +| Identity v3 |✓|✓|✓|✓|✓|✓| +| Identity v3 exts ||||||| +| Images v2 |✓|✓|✓|✓|✓|✓| +| Networking v2 |✓|✓|✓|✓|✓|✓| +| Networking v2 exts ||||||| +| Object Storage v1 |✓|✓|✓|✓|✓|✓| +| Orchestration v1 ||||||| +| Telemetry v2 ||||||| ## Key diff --git a/doc/services/block-storage/v2/index.rst b/doc/services/block-storage/v2/index.rst index 8086efc0e..9e046e319 100644 --- a/doc/services/block-storage/v2/index.rst +++ b/doc/services/block-storage/v2/index.rst @@ -1,9 +1,9 @@ Block Storage v2 ================ -.. toctree:: - :maxdepth: 3 +Block Storage v2 API is deprecated since Pike release and was removed in the Xena release. +It is recommended to use Block Storage v3 API instead. However most of endpoints are identical, so if you still need +to use Block Storage v2 API, you can use the change `$openstack->blockStorageV3()` to `$openstack->blockStorageV2()` in examples. +In most cases it will work without any other changes. - volumes - volume-types - snapshots +.. sample:: BlockStorage/v2/create_service.php diff --git a/doc/services/block-storage/v3/index.rst b/doc/services/block-storage/v3/index.rst new file mode 100644 index 000000000..d012ed563 --- /dev/null +++ b/doc/services/block-storage/v3/index.rst @@ -0,0 +1,9 @@ +Block Storage v3 +================ + +.. toctree:: + :maxdepth: 3 + + volumes + volume-types + snapshots diff --git a/doc/services/block-storage/v2/snapshots.rst b/doc/services/block-storage/v3/snapshots.rst similarity index 80% rename from doc/services/block-storage/v2/snapshots.rst rename to doc/services/block-storage/v3/snapshots.rst index 5365d6351..e3aea5f58 100644 --- a/doc/services/block-storage/v2/snapshots.rst +++ b/doc/services/block-storage/v3/snapshots.rst @@ -4,7 +4,7 @@ Snapshots List volumes ------------ -.. sample:: BlockStorage/v2/snapshots/list.php +.. sample:: BlockStorage/v3/snapshots/list.php .. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listSnapshots Each iteration will return a php:class:`Snapshot` instance . @@ -23,4 +23,4 @@ Possible values for sort_dir are: * asc * desc -.. sample:: BlockStorage/v2/snapshots/list_sorted.php \ No newline at end of file +.. sample:: BlockStorage/v3/snapshots/list_sorted.php \ No newline at end of file diff --git a/doc/services/block-storage/v2/volume-types.rst b/doc/services/block-storage/v3/volume-types.rst similarity index 85% rename from doc/services/block-storage/v2/volume-types.rst rename to doc/services/block-storage/v3/volume-types.rst index cb515a0d7..b89d0222b 100644 --- a/doc/services/block-storage/v2/volume-types.rst +++ b/doc/services/block-storage/v3/volume-types.rst @@ -3,7 +3,7 @@ Volume Types Listing volume types -------------------- -.. sample:: BlockStorage/v2/volume_types/list.php +.. sample:: BlockStorage/v3/volume_types/list.php .. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumeTypes Each iteration will return a :php:class:`VolumeType` instance . @@ -17,7 +17,7 @@ Create volume type The only attributes that are required when creating a volume are a name. The simplest example would therefore be this: -.. sample:: BlockStorage/v2/volume_types/create.php +.. sample:: BlockStorage/v3/volume_types/create.php .. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_createVolumeType @@ -27,7 +27,7 @@ Retrieve details of a volume type When retrieving a volume type, sometimes you only want to operate on it - say to update or delete it. If this is the case, then there is no need to perform an initial GET request to the API: -.. sample:: BlockStorage/v2/volume_types/get.php +.. sample:: BlockStorage/v3/volume_types/get.php If, however, you *do* want to retrieve all the details of a remote volume type from the API, you just call: @@ -46,7 +46,7 @@ Update a volume type The first step when updating a volume type is modifying the attributes you want updated. By default, only a volume type's name can be edited. -.. sample:: BlockStorage/v2/volume_types/update.php +.. sample:: BlockStorage/v3/volume_types/update.php .. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_update @@ -55,5 +55,5 @@ Delete volume type To permanently delete a volume type: -.. sample:: BlockStorage/v2/volume_types/delete.php +.. sample:: BlockStorage/v3/volume_types/delete.php .. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_delete \ No newline at end of file diff --git a/doc/services/block-storage/v2/volumes.rst b/doc/services/block-storage/v3/volumes.rst similarity index 80% rename from doc/services/block-storage/v2/volumes.rst rename to doc/services/block-storage/v3/volumes.rst index e0d0691fa..82843b6cd 100644 --- a/doc/services/block-storage/v2/volumes.rst +++ b/doc/services/block-storage/v3/volumes.rst @@ -4,7 +4,7 @@ Volumes List volumes ------------ -.. sample:: BlockStorage/v2/volumes/list.php +.. sample:: BlockStorage/v3/volumes/list.php .. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumes Each iteration will return a php:class:`Volume` instance . @@ -17,7 +17,7 @@ Detailed information By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information for a flavor, you must enable detailed information, like so: -.. sample:: BlockStorage/v2/volumes/list_detail.php +.. sample:: BlockStorage/v3/volumes/list_detail.php Create volume ------------- @@ -25,7 +25,7 @@ Create volume The only attributes that are required when creating a volume are a size in GiB. The simplest example would therefore be this: -.. sample:: BlockStorage/v2/volumes/create.php +.. sample:: BlockStorage/v3/volumes/create.php You can further configure your new volume, however, by following the below sections, which instruct you how to add specific functionality. @@ -35,17 +35,17 @@ specific functionality. Create from image ~~~~~~~~~~~~~~~~~ -.. sample:: BlockStorage/v2/volumes/create_from_image.php +.. sample:: BlockStorage/v3/volumes/create_from_image.php Create from snapshot ~~~~~~~~~~~~~~~~~~~~ -.. sample:: BlockStorage/v2/volumes/create_from_snapshot.php +.. sample:: BlockStorage/v3/volumes/create_from_snapshot.php Create from source volume ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. sample:: BlockStorage/v2/volumes/create_from_source_volume.php +.. sample:: BlockStorage/v3/volumes/create_from_source_volume.php Retrieve volume details @@ -54,7 +54,7 @@ Retrieve volume details When retrieving a volume, sometimes you only want to operate on it - say to update or delete it. If this is the case, then there is no need to perform an initial GET request to the API: -.. sample:: BlockStorage/v2/volumes/get.php +.. sample:: BlockStorage/v3/volumes/get.php If, however, you *do* want to retrieve all the details of a remote volume from the API, you just call: @@ -73,7 +73,7 @@ Update volume The first step when updating a volume is modifying the attributes you want updated. By default, only a volume's name and description can be edited. -.. sample:: BlockStorage/v2/volumes/update.php +.. sample:: BlockStorage/v3/volumes/update.php .. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_update Delete volume @@ -81,5 +81,5 @@ Delete volume To permanently delete a volume: -.. sample:: BlockStorage/v2/volumes/delete.php +.. sample:: BlockStorage/v3/volumes/delete.php .. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_delete \ No newline at end of file diff --git a/samples/BlockStorage/v2/create_service.php b/samples/BlockStorage/v2/create_service.php new file mode 100644 index 000000000..fbed17dcf --- /dev/null +++ b/samples/BlockStorage/v2/create_service.php @@ -0,0 +1,12 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => ['id' => '{userId}', 'password' => '{password}'], + 'scope' => ['project' => ['id' => '{projectId}']] +]); + +$service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v2/snapshots/create.php b/samples/BlockStorage/v3/snapshots/create.php similarity index 90% rename from samples/BlockStorage/v2/snapshots/create.php rename to samples/BlockStorage/v3/snapshots/create.php index fdab656ab..94ad40aec 100644 --- a/samples/BlockStorage/v2/snapshots/create.php +++ b/samples/BlockStorage/v3/snapshots/create.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->createSnapshot([ 'volumeId' => '{volumeId}', diff --git a/samples/BlockStorage/v2/snapshots/delete.php b/samples/BlockStorage/v3/snapshots/delete.php similarity index 89% rename from samples/BlockStorage/v2/snapshots/delete.php rename to samples/BlockStorage/v3/snapshots/delete.php index a7bc30db3..7136ca1eb 100644 --- a/samples/BlockStorage/v2/snapshots/delete.php +++ b/samples/BlockStorage/v3/snapshots/delete.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->getSnapshot('{snapshotId}'); $snapshot->delete(); diff --git a/samples/BlockStorage/v2/snapshots/get.php b/samples/BlockStorage/v3/snapshots/get.php similarity index 88% rename from samples/BlockStorage/v2/snapshots/get.php rename to samples/BlockStorage/v3/snapshots/get.php index d87a89c80..2466cbfc1 100644 --- a/samples/BlockStorage/v2/snapshots/get.php +++ b/samples/BlockStorage/v3/snapshots/get.php @@ -9,6 +9,6 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->getSnapshot('{snapshotId}'); diff --git a/samples/BlockStorage/v2/snapshots/get_metadata.php b/samples/BlockStorage/v3/snapshots/get_metadata.php similarity index 89% rename from samples/BlockStorage/v2/snapshots/get_metadata.php rename to samples/BlockStorage/v3/snapshots/get_metadata.php index 17a291877..76e319a6c 100644 --- a/samples/BlockStorage/v2/snapshots/get_metadata.php +++ b/samples/BlockStorage/v3/snapshots/get_metadata.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $metadata = $service->getSnapshot('{snapshotId}') ->getMetadata(); diff --git a/samples/BlockStorage/v2/snapshots/list.php b/samples/BlockStorage/v3/snapshots/list.php similarity index 90% rename from samples/BlockStorage/v2/snapshots/list.php rename to samples/BlockStorage/v3/snapshots/list.php index 6853cd9eb..5d58bda95 100644 --- a/samples/BlockStorage/v2/snapshots/list.php +++ b/samples/BlockStorage/v3/snapshots/list.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshots = $service->listSnapshots(); diff --git a/samples/BlockStorage/v2/snapshots/list_detail.php b/samples/BlockStorage/v3/snapshots/list_detail.php similarity index 91% rename from samples/BlockStorage/v2/snapshots/list_detail.php rename to samples/BlockStorage/v3/snapshots/list_detail.php index aab57992c..525ea482f 100644 --- a/samples/BlockStorage/v2/snapshots/list_detail.php +++ b/samples/BlockStorage/v3/snapshots/list_detail.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshots = $service->listSnapshots(true); diff --git a/samples/BlockStorage/v2/snapshots/list_sorted.php b/samples/BlockStorage/v3/snapshots/list_sorted.php similarity index 92% rename from samples/BlockStorage/v2/snapshots/list_sorted.php rename to samples/BlockStorage/v3/snapshots/list_sorted.php index e00c18aa1..1f01301d3 100644 --- a/samples/BlockStorage/v2/snapshots/list_sorted.php +++ b/samples/BlockStorage/v3/snapshots/list_sorted.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshots = $service->listSnapshots(false, ['sortKey' => '{sortKey}', 'sortDir' => '{sortDir}']); diff --git a/samples/BlockStorage/v2/snapshots/merge_metadata.php b/samples/BlockStorage/v3/snapshots/merge_metadata.php similarity index 90% rename from samples/BlockStorage/v2/snapshots/merge_metadata.php rename to samples/BlockStorage/v3/snapshots/merge_metadata.php index 182bfd503..c85386c78 100644 --- a/samples/BlockStorage/v2/snapshots/merge_metadata.php +++ b/samples/BlockStorage/v3/snapshots/merge_metadata.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->getSnapshot('{snapshotId}'); diff --git a/samples/BlockStorage/v2/snapshots/reset_metadata.php b/samples/BlockStorage/v3/snapshots/reset_metadata.php similarity index 90% rename from samples/BlockStorage/v2/snapshots/reset_metadata.php rename to samples/BlockStorage/v3/snapshots/reset_metadata.php index afaac8ef6..d0d7a710d 100644 --- a/samples/BlockStorage/v2/snapshots/reset_metadata.php +++ b/samples/BlockStorage/v3/snapshots/reset_metadata.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->getSnapshot('{snapshotId}'); diff --git a/samples/BlockStorage/v2/snapshots/update.php b/samples/BlockStorage/v3/snapshots/update.php similarity index 91% rename from samples/BlockStorage/v2/snapshots/update.php rename to samples/BlockStorage/v3/snapshots/update.php index f72a15a0e..3310d44a1 100644 --- a/samples/BlockStorage/v2/snapshots/update.php +++ b/samples/BlockStorage/v3/snapshots/update.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $snapshot = $service->getSnapshot('{snapshotId}'); diff --git a/samples/BlockStorage/v2/volume_types/create.php b/samples/BlockStorage/v3/volume_types/create.php similarity index 89% rename from samples/BlockStorage/v2/volume_types/create.php rename to samples/BlockStorage/v3/volume_types/create.php index f9042a7f8..92a8eb459 100644 --- a/samples/BlockStorage/v2/volume_types/create.php +++ b/samples/BlockStorage/v3/volume_types/create.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumeType = $service->createVolumeType([ 'name' => '{name}', diff --git a/samples/BlockStorage/v2/volume_types/delete.php b/samples/BlockStorage/v3/volume_types/delete.php similarity index 89% rename from samples/BlockStorage/v2/volume_types/delete.php rename to samples/BlockStorage/v3/volume_types/delete.php index 11f02cac3..c8a68b756 100644 --- a/samples/BlockStorage/v2/volume_types/delete.php +++ b/samples/BlockStorage/v3/volume_types/delete.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumeType = $service->getVolumeType('{volumeTypeId}'); $volumeType->delete(); diff --git a/samples/BlockStorage/v2/volume_types/get.php b/samples/BlockStorage/v3/volume_types/get.php similarity index 88% rename from samples/BlockStorage/v2/volume_types/get.php rename to samples/BlockStorage/v3/volume_types/get.php index 19051d0f0..fc86ab574 100644 --- a/samples/BlockStorage/v2/volume_types/get.php +++ b/samples/BlockStorage/v3/volume_types/get.php @@ -9,6 +9,6 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumeType = $service->getVolumeType('{volumeTypeId}'); diff --git a/samples/BlockStorage/v2/volume_types/list.php b/samples/BlockStorage/v3/volume_types/list.php similarity index 91% rename from samples/BlockStorage/v2/volume_types/list.php rename to samples/BlockStorage/v3/volume_types/list.php index 567aed53b..3c6d3bf80 100644 --- a/samples/BlockStorage/v2/volume_types/list.php +++ b/samples/BlockStorage/v3/volume_types/list.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumeTypes = $service->listVolumeTypes(); diff --git a/samples/BlockStorage/v2/volume_types/update.php b/samples/BlockStorage/v3/volume_types/update.php similarity index 90% rename from samples/BlockStorage/v2/volume_types/update.php rename to samples/BlockStorage/v3/volume_types/update.php index 5f24db38d..edcd9dec4 100644 --- a/samples/BlockStorage/v2/volume_types/update.php +++ b/samples/BlockStorage/v3/volume_types/update.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumeType = $service->getVolumeType('{volumeTypeId}'); $volumeType->name = '{newName}'; diff --git a/samples/BlockStorage/v2/volumes/create.php b/samples/BlockStorage/v3/volumes/create.php similarity index 92% rename from samples/BlockStorage/v2/volumes/create.php rename to samples/BlockStorage/v3/volumes/create.php index eb48f8bdd..b8fd93081 100644 --- a/samples/BlockStorage/v2/volumes/create.php +++ b/samples/BlockStorage/v3/volumes/create.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->createVolume([ 'description' => '{description}', diff --git a/samples/BlockStorage/v2/volumes/create_from_image.php b/samples/BlockStorage/v3/volumes/create_from_image.php similarity index 91% rename from samples/BlockStorage/v2/volumes/create_from_image.php rename to samples/BlockStorage/v3/volumes/create_from_image.php index 0701e39fa..81d36d9ee 100644 --- a/samples/BlockStorage/v2/volumes/create_from_image.php +++ b/samples/BlockStorage/v3/volumes/create_from_image.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->createVolume([ 'description' => '{description}', diff --git a/samples/BlockStorage/v2/volumes/create_from_snapshot.php b/samples/BlockStorage/v3/volumes/create_from_snapshot.php similarity index 91% rename from samples/BlockStorage/v2/volumes/create_from_snapshot.php rename to samples/BlockStorage/v3/volumes/create_from_snapshot.php index dfff8ea91..a88c2d442 100644 --- a/samples/BlockStorage/v2/volumes/create_from_snapshot.php +++ b/samples/BlockStorage/v3/volumes/create_from_snapshot.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->createVolume([ 'description' => '{description}', diff --git a/samples/BlockStorage/v2/volumes/create_from_source_volume.php b/samples/BlockStorage/v3/volumes/create_from_source_volume.php similarity index 91% rename from samples/BlockStorage/v2/volumes/create_from_source_volume.php rename to samples/BlockStorage/v3/volumes/create_from_source_volume.php index 1f26a61e6..571e12318 100644 --- a/samples/BlockStorage/v2/volumes/create_from_source_volume.php +++ b/samples/BlockStorage/v3/volumes/create_from_source_volume.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->createVolume([ 'description' => '{description}', diff --git a/samples/BlockStorage/v2/volumes/delete.php b/samples/BlockStorage/v3/volumes/delete.php similarity index 88% rename from samples/BlockStorage/v2/volumes/delete.php rename to samples/BlockStorage/v3/volumes/delete.php index 46527f048..1821ca9e1 100644 --- a/samples/BlockStorage/v2/volumes/delete.php +++ b/samples/BlockStorage/v3/volumes/delete.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->getVolume('{volumeId}'); $volume->delete(); diff --git a/samples/BlockStorage/v2/volumes/get.php b/samples/BlockStorage/v3/volumes/get.php similarity index 88% rename from samples/BlockStorage/v2/volumes/get.php rename to samples/BlockStorage/v3/volumes/get.php index 2c3477878..184c02afd 100644 --- a/samples/BlockStorage/v2/volumes/get.php +++ b/samples/BlockStorage/v3/volumes/get.php @@ -9,6 +9,6 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->getVolume('{volumeId}'); diff --git a/samples/BlockStorage/v2/volumes/list.php b/samples/BlockStorage/v3/volumes/list.php similarity index 90% rename from samples/BlockStorage/v2/volumes/list.php rename to samples/BlockStorage/v3/volumes/list.php index d91d0145b..0b1d5c83a 100644 --- a/samples/BlockStorage/v2/volumes/list.php +++ b/samples/BlockStorage/v3/volumes/list.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volumes = $service->listVolumes(); diff --git a/samples/BlockStorage/v2/volumes/list_detail.php b/samples/BlockStorage/v3/volumes/list_detail.php similarity index 90% rename from samples/BlockStorage/v2/volumes/list_detail.php rename to samples/BlockStorage/v3/volumes/list_detail.php index a67d35a4a..e495fbc32 100644 --- a/samples/BlockStorage/v2/volumes/list_detail.php +++ b/samples/BlockStorage/v3/volumes/list_detail.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); foreach ($service->listVolumes(true) as $volume) { /** @var $volume \OpenStack\BlockStorage\v2\Models\Volume */ diff --git a/samples/BlockStorage/v2/volumes/update.php b/samples/BlockStorage/v3/volumes/update.php similarity index 90% rename from samples/BlockStorage/v2/volumes/update.php rename to samples/BlockStorage/v3/volumes/update.php index 07605d3f6..d9de1d53c 100644 --- a/samples/BlockStorage/v2/volumes/update.php +++ b/samples/BlockStorage/v3/volumes/update.php @@ -9,7 +9,7 @@ 'scope' => ['project' => ['id' => '{projectId}']] ]); -$service = $openstack->blockStorageV2(); +$service = $openstack->blockStorageV3(); $volume = $service->getVolume('{volumeId}'); diff --git a/src/BlockStorage/v3/Api.php b/src/BlockStorage/v3/Api.php new file mode 100644 index 000000000..1b8c194f0 --- /dev/null +++ b/src/BlockStorage/v3/Api.php @@ -0,0 +1,8 @@ +builder->createService('BlockStorage\\v2', array_merge($defaults, $options)); } + /** + * Creates a new Block Storage v3 service. + * + * @param array $options options that will be used in configuring the service + */ + public function blockStorageV3(array $options = []): BlockStorage\v3\Service + { + $defaults = ['catalogName' => 'cinderv3', 'catalogType' => 'volumev3']; + + return $this->builder->createService('BlockStorage\\v3', array_merge($defaults, $options)); + } + /** * Creates a new Images v2 service. * diff --git a/tests/integration/BlockStorage/v2/CoreTest.php b/tests/integration/BlockStorage/v2/CoreTest.php index 352e07441..d41939298 100644 --- a/tests/integration/BlockStorage/v2/CoreTest.php +++ b/tests/integration/BlockStorage/v2/CoreTest.php @@ -2,20 +2,13 @@ namespace OpenStack\Integration\BlockStorage\v2; -use OpenStack\BlockStorage\v2\Models\Snapshot; -use OpenStack\BlockStorage\v2\Models\Volume; -use OpenStack\BlockStorage\v2\Models\VolumeType; -use OpenStack\Integration\TestCase; +use OpenStack\BlockStorage\v2\Service; +use OpenStack\Integration\BlockStorage\v3\CoreV2Test; use OpenStack\Integration\Utils; -class CoreTest extends TestCase +class CoreTest extends CoreV2Test { - private $service; - - /** - * @return \OpenStack\BlockStorage\v2\Service - */ - private function getService() + protected function getService() : Service { if (null === $this->service) { $this->service = Utils::getOpenStack()->blockStorageV2(); @@ -24,230 +17,13 @@ private function getService() return $this->service; } - public function runTests() - { - $this->startTimer(); - - $this->logger->info('-> Volumes'); - $this->volumes(); - $this->logger->info('-> Volume Types'); - $this->volumeTypes(); - $this->logger->info('-> Snapshots'); - $this->snapshots(); - $this->logger->info('-> Snapshot list'); - $this->snapshotList(); - - $this->outputTimeTaken(); - } - - public function volumes() + protected function sampleFile(array $replacements, $path) { - $this->logStep('Creating volume type'); - $volumeType = $this->getService()->createVolumeType(['name' => $this->randomStr()]); - - $replacements = [ - '{description}' => $this->randomStr(), - "'{size}'" => 1, - '{name}' => $this->randomStr(), - '{volumeType}' => $volumeType->id, - '{key1}' => $this->randomStr(), - '{val1}' => $this->randomStr(), - ]; - - $this->logStep('Creating volume'); - /** @var Volume $volume */ - require_once $this->sampleFile($replacements, 'volumes/create.php'); - self::assertInstanceOf(Volume::class, $volume); - self::assertEquals($replacements['{name}'], $volume->name); - self::assertEquals(1, $volume->size); - self::assertEquals($volumeType->name, $volume->volumeTypeName); - - $volumeId = $volume->id; - $replacements = ['{volumeId}' => $volumeId]; - - $this->logStep('Getting volume'); - /** @var Volume $volume */ - require_once $this->sampleFile($replacements, 'volumes/get.php'); - self::assertInstanceOf(Volume::class, $volume); - - $replacements += [ - '{newName}' => $this->randomStr(), - '{newDescription}' => $this->randomStr(), - ]; - - $this->logStep('Updating volume'); - /** @var Volume $volume */ - require_once $this->sampleFile($replacements, 'volumes/update.php'); - self::assertInstanceOf(Volume::class, $volume); - - $this->logStep('Listing volumes'); - /** @var \Generator $volumes */ - require_once $this->sampleFile($replacements, 'volumes/list.php'); - - $volume = $this->getService()->getVolume($volumeId); - $volume->waitUntil('available'); - - $this->logStep('Deleting volume'); - require_once $this->sampleFile($replacements, 'volumes/delete.php'); - - $volume = $this->getService()->getVolume($volumeId); - $volume->waitUntilDeleted(); - - $this->logStep('Deleting volume type'); - $volumeType->delete(); - } - - public function volumeTypes() - { - $replacements = [ - '{name}' => $this->randomStr(), - ]; - - $this->logStep('Creating volume type'); - /** @var VolumeType $volumeType */ - require_once $this->sampleFile($replacements, 'volume_types/create.php'); - self::assertInstanceOf(VolumeType::class, $volumeType); - self::assertEquals($replacements['{name}'], $volumeType->name); - - $replacements = ['{volumeTypeId}' => $volumeType->id]; - - $this->logStep('Getting volume type'); - /** @var VolumeType $volumeType */ - require_once $this->sampleFile($replacements, 'volume_types/get.php'); - self::assertInstanceOf(VolumeType::class, $volumeType); - - $replacements += ['{newName}' => $this->randomStr()]; - - $this->logStep('Updating volume type'); - /** @var VolumeType $volumeType */ - require_once $this->sampleFile($replacements, 'volume_types/update.php'); - self::assertInstanceOf(VolumeType::class, $volumeType); - - $this->logStep('Listing volume types'); - /** @var \Generator $volumeTypes */ - require_once $this->sampleFile($replacements, 'volume_types/list.php'); - - $this->logStep('Deleting volume type'); - require_once $this->sampleFile($replacements, 'volume_types/delete.php'); - } - - public function snapshots() - { - $this->logStep('Creating volume'); - $volume = $this->getService()->createVolume(['name' => $this->randomStr(), 'size' => 1]); - $volume->waitUntil('available', 60); - - $replacements = [ - '{volumeId}' => $volume->id, - '{name}' => $this->randomStr(), - '{description}' => $this->randomStr(), - ]; - - $this->logStep('Creating snapshot'); - /** @var Snapshot $snapshot */ - require_once $this->sampleFile($replacements, 'snapshots/create.php'); - self::assertInstanceOf(Snapshot::class, $snapshot); - self::assertEquals($replacements['{name}'], $snapshot->name); - $volume->waitUntil('available', 60); - - $snapshotId = $snapshot->id; - $replacements = ['{snapshotId}' => $snapshotId]; - - $this->logStep('Getting snapshot'); - /** @var Snapshot $snapshot */ - require_once $this->sampleFile($replacements, 'snapshots/get.php'); - self::assertInstanceOf(Snapshot::class, $snapshot); - - $this->getService() - ->getSnapshot($snapshot->id) - ->mergeMetadata(['key1' => 'val1']); - - $replacements += ['{key}' => 'key2', '{val}' => 'val2']; - $this->logStep('Adding metadata'); - require_once $this->sampleFile($replacements, 'snapshots/merge_metadata.php'); - - $this->logStep('Retrieving metadata'); - /** @var array $metadata */ - require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php'); - self::assertEquals(['key1' => 'val1', 'key2' => 'val2'], $metadata); - - $replacements = ['{snapshotId}' => $snapshot->id, '{key}' => 'key3', '{val}' => 'val3']; - $this->logStep('Resetting metadata'); - require_once $this->sampleFile($replacements, 'snapshots/reset_metadata.php'); - - $this->logStep('Retrieving metadata'); - /** @var array $metadata */ - require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php'); - self::assertEquals(['key3' => 'val3'], $metadata); - - $replacements += ['{newName}' => $this->randomStr(), '{newDescription}' => $this->randomStr()]; - $this->logStep('Updating snapshot'); - require_once $this->sampleFile($replacements, 'snapshots/update.php'); - - $snapshot->waitUntil('available', 60); - - $this->logStep('Listing snapshots'); - require_once $this->sampleFile($replacements, 'snapshots/list.php'); - - $this->logStep('Deleting snapshot'); - require_once $this->sampleFile($replacements, 'snapshots/delete.php'); - $snapshot->waitUntilDeleted(); - - $this->logStep('Deleting volume'); - $volume->delete(); - } - - public function snapshotList() - { - $this->logStep('Creating volume'); - $volume = $this->getService()->createVolume(['name' => $this->randomStr(), 'size' => 1]); - $volume->waitUntil('available', 60); - - $names = ['b' . $this->randomStr(), 'a' . $this->randomStr(), 'd' . $this->randomStr(), 'c' . $this->randomStr()]; - $createdSnapshots = []; - foreach ($names as $name) { - $this->logStep('Creating snapshot ' . $name); - $snapshot = $this->getService()->createSnapshot([ - 'volumeId' => $volume->id, - 'name' => $name, - ]); - - self::assertInstanceOf(Snapshot::class, $snapshot); - - $createdSnapshots[] = $snapshot; - $snapshot->waitUntil('available', 60); - } - - try { - $replacements = [ - '{sortKey}' => 'display_name', - '{sortDir}' => 'asc', - ]; - - $this->logStep('Listing snapshots'); - require_once $this->sampleFile($replacements, 'snapshots/list.php'); - - $this->logStep('Listing snapshots sorted asc'); - /** @var Snapshot $snapshot */ - require_once $this->sampleFile($replacements, 'snapshots/list_sorted.php'); - self::assertInstanceOf(Snapshot::class, $snapshot); - self::assertEquals($names[2], $snapshot->name); - - $this->logStep('Listing snapshots sorted desc'); - $replacements['{sortDir}'] = 'desc'; - /** @var Snapshot $snapshot */ - require_once $this->sampleFile($replacements, 'snapshots/list_sorted.php'); - self::assertInstanceOf(Snapshot::class, $snapshot); - self::assertEquals($names[1], $snapshot->name); - } finally { - foreach ($createdSnapshots as $snapshot) { - $this->logStep('Deleting snapshot ' . $snapshot->name); - $snapshot->delete(); - $snapshot->waitUntilDeleted(); - } - - $this->logStep('Deleting volume'); - $volume->delete(); - } + return parent::sampleFile( + array_merge( + $replacements, + ['$openstack->blockStorageV3()' => '$openstack->blockStorageV2()'] + ), + '../v3/' . $path); } } diff --git a/tests/integration/BlockStorage/v3/CoreV2Test.php b/tests/integration/BlockStorage/v3/CoreV2Test.php new file mode 100644 index 000000000..977b7ba04 --- /dev/null +++ b/tests/integration/BlockStorage/v3/CoreV2Test.php @@ -0,0 +1,252 @@ +service) { + $this->service = Utils::getOpenStack()->blockStorageV3(); + } + + return $this->service; + } + + public function runTests() + { + $this->startTimer(); + + $this->logger->info('-> Volumes'); + $this->volumes(); + $this->logger->info('-> Volume Types'); + $this->volumeTypes(); + $this->logger->info('-> Snapshots'); + $this->snapshots(); + $this->logger->info('-> Snapshot list'); + $this->snapshotList(); + + $this->outputTimeTaken(); + } + + public function volumes() + { + $this->logStep('Creating volume type'); + $volumeType = $this->getService()->createVolumeType(['name' => $this->randomStr()]); + + $replacements = [ + '{description}' => $this->randomStr(), + "'{size}'" => 1, + '{name}' => $this->randomStr(), + '{volumeType}' => $volumeType->id, + '{key1}' => $this->randomStr(), + '{val1}' => $this->randomStr(), + ]; + + $this->logStep('Creating volume'); + /** @var Volume $volume */ + require_once $this->sampleFile($replacements, 'volumes/create.php'); + self::assertInstanceOf(Volume::class, $volume); + self::assertEquals($replacements['{name}'], $volume->name); + self::assertEquals(1, $volume->size); + self::assertEquals($volumeType->name, $volume->volumeTypeName); + + $volumeId = $volume->id; + $replacements = ['{volumeId}' => $volumeId]; + + $this->logStep('Getting volume'); + /** @var Volume $volume */ + require_once $this->sampleFile($replacements, 'volumes/get.php'); + self::assertInstanceOf(Volume::class, $volume); + + $replacements += [ + '{newName}' => $this->randomStr(), + '{newDescription}' => $this->randomStr(), + ]; + + $this->logStep('Updating volume'); + /** @var Volume $volume */ + require_once $this->sampleFile($replacements, 'volumes/update.php'); + self::assertInstanceOf(Volume::class, $volume); + + $this->logStep('Listing volumes'); + /** @var \Generator $volumes */ + require_once $this->sampleFile($replacements, 'volumes/list.php'); + + $volume = $this->getService()->getVolume($volumeId); + $volume->waitUntil('available'); + + $this->logStep('Deleting volume'); + require_once $this->sampleFile($replacements, 'volumes/delete.php'); + + $volume = $this->getService()->getVolume($volumeId); + $volume->waitUntilDeleted(); + + $this->logStep('Deleting volume type'); + $volumeType->delete(); + } + + public function volumeTypes() + { + $replacements = [ + '{name}' => $this->randomStr(), + ]; + + $this->logStep('Creating volume type'); + /** @var VolumeType $volumeType */ + require_once $this->sampleFile($replacements, 'volume_types/create.php'); + self::assertInstanceOf(VolumeType::class, $volumeType); + self::assertEquals($replacements['{name}'], $volumeType->name); + + $replacements = ['{volumeTypeId}' => $volumeType->id]; + + $this->logStep('Getting volume type'); + /** @var VolumeType $volumeType */ + require_once $this->sampleFile($replacements, 'volume_types/get.php'); + self::assertInstanceOf(VolumeType::class, $volumeType); + + $replacements += ['{newName}' => $this->randomStr()]; + + $this->logStep('Updating volume type'); + /** @var VolumeType $volumeType */ + require_once $this->sampleFile($replacements, 'volume_types/update.php'); + self::assertInstanceOf(VolumeType::class, $volumeType); + + $this->logStep('Listing volume types'); + /** @var \Generator $volumeTypes */ + require_once $this->sampleFile($replacements, 'volume_types/list.php'); + + $this->logStep('Deleting volume type'); + require_once $this->sampleFile($replacements, 'volume_types/delete.php'); + } + + public function snapshots() + { + $this->logStep('Creating volume'); + $volume = $this->getService()->createVolume(['name' => $this->randomStr(), 'size' => 1]); + $volume->waitUntil('available', 60); + + $replacements = [ + '{volumeId}' => $volume->id, + '{name}' => $this->randomStr(), + '{description}' => $this->randomStr(), + ]; + + $this->logStep('Creating snapshot'); + /** @var Snapshot $snapshot */ + require_once $this->sampleFile($replacements, 'snapshots/create.php'); + self::assertInstanceOf(Snapshot::class, $snapshot); + self::assertEquals($replacements['{name}'], $snapshot->name); + $volume->waitUntil('available', 60); + + $snapshotId = $snapshot->id; + $replacements = ['{snapshotId}' => $snapshotId]; + + $this->logStep('Getting snapshot'); + /** @var Snapshot $snapshot */ + require_once $this->sampleFile($replacements, 'snapshots/get.php'); + self::assertInstanceOf(Snapshot::class, $snapshot); + + $this->getService() + ->getSnapshot($snapshot->id) + ->mergeMetadata(['key1' => 'val1']); + + $replacements += ['{key}' => 'key2', '{val}' => 'val2']; + $this->logStep('Adding metadata'); + require_once $this->sampleFile($replacements, 'snapshots/merge_metadata.php'); + + $this->logStep('Retrieving metadata'); + /** @var array $metadata */ + require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php'); + self::assertEquals(['key1' => 'val1', 'key2' => 'val2'], $metadata); + + $replacements = ['{snapshotId}' => $snapshot->id, '{key}' => 'key3', '{val}' => 'val3']; + $this->logStep('Resetting metadata'); + require_once $this->sampleFile($replacements, 'snapshots/reset_metadata.php'); + + $this->logStep('Retrieving metadata'); + /** @var array $metadata */ + require_once $this->sampleFile($replacements, 'snapshots/get_metadata.php'); + self::assertEquals(['key3' => 'val3'], $metadata); + + $replacements += ['{newName}' => $this->randomStr(), '{newDescription}' => $this->randomStr()]; + $this->logStep('Updating snapshot'); + require_once $this->sampleFile($replacements, 'snapshots/update.php'); + + $snapshot->waitUntil('available', 60); + + $this->logStep('Listing snapshots'); + require_once $this->sampleFile($replacements, 'snapshots/list.php'); + + $this->logStep('Deleting snapshot'); + require_once $this->sampleFile($replacements, 'snapshots/delete.php'); + $snapshot->waitUntilDeleted(); + + $this->logStep('Deleting volume'); + $volume->delete(); + } + + public function snapshotList() + { + $this->logStep('Creating volume'); + $volume = $this->getService()->createVolume(['name' => $this->randomStr(), 'size' => 1]); + $volume->waitUntil('available', 60); + + $names = ['b' . $this->randomStr(), 'a' . $this->randomStr(), 'd' . $this->randomStr(), 'c' . $this->randomStr()]; + $createdSnapshots = []; + foreach ($names as $name) { + $this->logStep('Creating snapshot ' . $name); + $snapshot = $this->getService()->createSnapshot([ + 'volumeId' => $volume->id, + 'name' => $name, + ]); + + self::assertInstanceOf(Snapshot::class, $snapshot); + + $createdSnapshots[] = $snapshot; + $snapshot->waitUntil('available', 60); + } + + try { + $replacements = [ + '{sortKey}' => 'display_name', + '{sortDir}' => 'asc', + ]; + + $this->logStep('Listing snapshots'); + require_once $this->sampleFile($replacements, 'snapshots/list.php'); + + $this->logStep('Listing snapshots sorted asc'); + /** @var Snapshot $snapshot */ + require_once $this->sampleFile($replacements, 'snapshots/list_sorted.php'); + self::assertInstanceOf(Snapshot::class, $snapshot); + self::assertEquals($names[2], $snapshot->name); + + $this->logStep('Listing snapshots sorted desc'); + $replacements['{sortDir}'] = 'desc'; + /** @var Snapshot $snapshot */ + require_once $this->sampleFile($replacements, 'snapshots/list_sorted.php'); + self::assertInstanceOf(Snapshot::class, $snapshot); + self::assertEquals($names[1], $snapshot->name); + } finally { + foreach ($createdSnapshots as $snapshot) { + $this->logStep('Deleting snapshot ' . $snapshot->name); + $snapshot->delete(); + $snapshot->waitUntilDeleted(); + } + + $this->logStep('Deleting volume'); + $volume->delete(); + } + } + +} \ No newline at end of file diff --git a/tests/integration/Compute/v2/CoreTest.php b/tests/integration/Compute/v2/CoreTest.php index f1f205285..e67eb4192 100644 --- a/tests/integration/Compute/v2/CoreTest.php +++ b/tests/integration/Compute/v2/CoreTest.php @@ -87,7 +87,7 @@ private function getSecurityGroupService(): SecurityGroupService private function getBlockStorageService() { if (!$this->blockStorageService) { - $this->blockStorageService = Utils::getOpenStack()->blockStorageV2(); + $this->blockStorageService = Utils::getOpenStack()->blockStorageV3(); } return $this->blockStorageService; @@ -690,7 +690,7 @@ private function attachVolumeToServer() ]; require_once $this->sampleFile($replacements, 'servers/attach_volume_attachment.php'); - /**@var VolumeAttachment $volumeAttachment */ + /** @var \OpenStack\BlockStorage\v2\Models\VolumeAttachment $volumeAttachment */ $this->volumeAttachmentId = $volumeAttachment->id; $this->volume->waitUntil('in-use'); diff --git a/tests/integration/SampleManager.php b/tests/integration/SampleManager.php index 42ee22c94..14998109c 100644 --- a/tests/integration/SampleManager.php +++ b/tests/integration/SampleManager.php @@ -1,8 +1,6 @@ rootFixturesDir = __DIR__; - $this->service = new Service($this->client->reveal(), new Api()); } diff --git a/tests/unit/BlockStorage/v3/FromV2/Models/QuotaSetTest.php b/tests/unit/BlockStorage/v3/FromV2/Models/QuotaSetTest.php new file mode 100644 index 000000000..06fb93dc5 --- /dev/null +++ b/tests/unit/BlockStorage/v3/FromV2/Models/QuotaSetTest.php @@ -0,0 +1,17 @@ +quotaSet = new QuotaSet($this->client->reveal(), new Api()); + $this->quotaSet->tenantId = 'tenant-foo'; + } +} \ No newline at end of file diff --git a/tests/unit/BlockStorage/v3/FromV2/Models/SnapshotTest.php b/tests/unit/BlockStorage/v3/FromV2/Models/SnapshotTest.php new file mode 100644 index 000000000..de658b513 --- /dev/null +++ b/tests/unit/BlockStorage/v3/FromV2/Models/SnapshotTest.php @@ -0,0 +1,17 @@ +snapshot = new Snapshot($this->client->reveal(), new Api()); + $this->snapshot->id = '1'; + } +} \ No newline at end of file diff --git a/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTest.php b/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTest.php new file mode 100644 index 000000000..d31ab8649 --- /dev/null +++ b/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTest.php @@ -0,0 +1,17 @@ +volume = new Volume($this->client->reveal(), new Api()); + $this->volume->id = '1'; + } +} \ No newline at end of file diff --git a/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTypeTest.php b/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTypeTest.php new file mode 100644 index 000000000..30db3d2e1 --- /dev/null +++ b/tests/unit/BlockStorage/v3/FromV2/Models/VolumeTypeTest.php @@ -0,0 +1,17 @@ +volumeType = new VolumeType($this->client->reveal(), new Api()); + $this->volumeType->id = '1'; + } +} \ No newline at end of file diff --git a/tests/unit/BlockStorage/v3/FromV2/ServiceTest.php b/tests/unit/BlockStorage/v3/FromV2/ServiceTest.php new file mode 100644 index 000000000..9d5706286 --- /dev/null +++ b/tests/unit/BlockStorage/v3/FromV2/ServiceTest.php @@ -0,0 +1,16 @@ +service = new Service($this->client->reveal(), new Api()); + } +} diff --git a/tests/unit/OpenStackTest.php b/tests/unit/OpenStackTest.php index 4ffe3f46f..f0e9ee09a 100644 --- a/tests/unit/OpenStackTest.php +++ b/tests/unit/OpenStackTest.php @@ -14,6 +14,7 @@ use OpenStack\Networking\v2\Extensions\SecurityGroups\Service as NetworkingServiceV2ExtSecGroup; use OpenStack\ObjectStore\v1\Service as ObjectStoreServiceV1; use OpenStack\BlockStorage\v2\Service as BlockStorageServiceV2; +use OpenStack\BlockStorage\v3\Service as BlockStorageServiceV3; use OpenStack\Images\v2\Service as ImageServiceV2; use OpenStack\Metric\v1\Gnocchi\Service as MetricGnocchiV1; @@ -109,6 +110,16 @@ public function test_it_supports_block_storage_v2() $this->openstack->blockStorageV2(); } + public function test_it_supports_block_storage_v3() + { + $this->builder + ->createService('BlockStorage\\v3', ['catalogName' => 'cinderv3', 'catalogType' => 'volumev3']) + ->shouldBeCalled() + ->willReturn($this->service(BlockStorageServiceV3::class)); + + $this->openstack->blockStorageV3(); + } + public function test_it_supports_images_v2() { $this->builder