FUP: Add volume-update CLI pre V285 tests

This commit mainly to fix some comments from [1].

[1]https://review.opendev.org/#/c/712651/19/novaclient/tests/unit/v2/test_shell.py@4001

Blueprint: destroy-instance-with-datavolume
Change-Id: Id809f22d0da2cdedf33a2c0df202f3953fd01673
This commit is contained in:
zhangbailin 2020-04-10 08:39:35 +08:00
parent 4d6c70d25d
commit c5f29d6833
2 changed files with 15 additions and 1 deletions

View File

@ -3966,11 +3966,13 @@ new volume.
``--delete-on-termination`` ``--delete-on-termination``
Specify that the volume should be deleted when the server is destroyed. Specify that the volume should be deleted when the server is destroyed.
It is mutually exclusive with '--no-delete-on-termination'.
(Supported by API versions '2.85' - '2.latest') (Supported by API versions '2.85' - '2.latest')
``--no-delete-on-termination`` ``--no-delete-on-termination``
Specify that the attached volume should not be deleted when Specify that the attached volume should not be deleted when
the server is destroyed. (Supported by API versions '2.85' - '2.latest') the server is destroyed. It is mutually exclusive with '--delete-on-termination'.
(Supported by API versions '2.85' - '2.latest')
.. _nova_bash-completion: .. _nova_bash-completion:

View File

@ -4006,6 +4006,18 @@ class ShellTest(utils.TestCase):
self.assert_called('PUT', '/servers/1234/os-volume_attachments/Work', self.assert_called('PUT', '/servers/1234/os-volume_attachments/Work',
{'volumeAttachment': {'volumeId': 'Work'}}) {'volumeAttachment': {'volumeId': 'Work'}})
def test_volume_update_delete_on_termination_pre_v285(self):
self.assertRaises(
SystemExit, self.run_command,
'volume-update sample-server --delete-on-termination Work Work',
api_version='2.84')
def test_volume_update_no_delete_on_termination_pre_v285(self):
self.assertRaises(
SystemExit, self.run_command,
'volume-update sample-server --no-delete-on-termination Work Work',
api_version='2.84')
def test_volume_update_v285(self): def test_volume_update_v285(self):
self.run_command('volume-update sample-server --delete-on-termination ' self.run_command('volume-update sample-server --delete-on-termination '
'Work Work', api_version='2.85') 'Work Work', api_version='2.85')