diff options
| author | whoami-rajat <rajatdhasmana@gmail.com> | 2022-09-14 11:01:31 +0100 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2022-09-14 11:22:43 +0100 |
| commit | 1f63034441a63b968185e1678049c01205b8e6d7 (patch) | |
| tree | 73cba9d3a09b85a28b3649103b25681ef2c48866 /openstackclient/tests/unit | |
| parent | c6065c7a4796ad0a679a13cb6bd2b3b5a271f5cb (diff) | |
| download | python-openstackclient-1f63034441a63b968185e1678049c01205b8e6d7.tar.gz | |
compute: Require image when rebuilding a volume-backed server
A volume-backed server will have no image attribute (or rather the image
property will be set to the empty string). As such, if you want to try
rebuild you will need to specify an image [*]. Enforce this.
[*] Before microversion 2.93, this must be the same image. However, we
don't touch on that here. This will be addressed later.
Change-Id: I6842dabd7acb4e3a78f894e55e616625757eb6a4
Story: 2010297
Task: 46290
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_server.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py index ba86dff3..3daa4cc7 100644 --- a/openstackclient/tests/unit/compute/v2/test_server.py +++ b/openstackclient/tests/unit/compute/v2/test_server.py @@ -5781,6 +5781,25 @@ class TestServerRebuild(TestServer): self.get_image_mock.assert_called_with(self.image.id) self.server.rebuild.assert_called_with(self.image, None) + def test_rebuild_with_volume_backed_server_no_image(self): + # the volume-backed server will have the image attribute set to an + # empty string, not null/None + self.server.image = '' + + arglist = [ + self.server.id, + ] + verifylist = [ + ('server', self.server.id), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + exc = self.assertRaises( + exceptions.CommandError, + self.cmd.take_action, + parsed_args) + self.assertIn('The --image option is required', str(exc)) + def test_rebuild_with_name(self): name = 'test-server-xxx' arglist = [ |
