diff mbox series

[v2,3/3] iotests/041: block-job-complete on user-paused job

Message ID 20210409132948.195511-4-mreitz@redhat.com
State New
Headers show
Series job: Add job_wait_unpaused() for block-job-complete | expand

Commit Message

Max Reitz April 9, 2021, 1:29 p.m. UTC
Expand test_pause() to check what happens when issuing
block-job-complete on a job that is on STANDBY because it has been
paused by the user.  (This should be an error, and in particular not
hang job_wait_unpaused().)

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/041 | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Max Reitz April 9, 2021, 1:45 p.m. UTC | #1
On 09.04.21 15:29, Max Reitz wrote:
> Expand test_pause() to check what happens when issuing
> block-job-complete on a job that is on STANDBY because it has been
> paused by the user.  (This should be an error, and in particular not
> hang job_wait_unpaused().)
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   tests/qemu-iotests/041 | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
> index 5cc02b24fc..d2c9669741 100755
> --- a/tests/qemu-iotests/041
> +++ b/tests/qemu-iotests/041
> @@ -120,7 +120,18 @@ class TestSingleDrive(iotests.QMPTestCase):
>           result = self.vm.qmp('block-job-resume', device='drive0')
>           self.assert_qmp(result, 'return', {})
>   
> -        self.complete_and_wait()
> +        self.wait_ready()
> +
> +        # Check that a job on STANDBY cannot be completed
> +        self.pause_job('drive0')
> +        result = self.vm.qmp('block-job-complete', device='drive0')
> +        self.assert_qmp(result, 'error/desc',
> +                        "Job 'drive0' has been paused by the user")

Oops.  Should now be

"Job 'drive0' has been paused and needs to be explicitly resumed"

of course.

Max

> +
> +        result = self.vm.qmp('block-job-resume', device='drive0')
> +        self.assert_qmp(result, 'return', {})
> +
> +        self.complete_and_wait(wait_ready=False)
>           self.vm.shutdown()
>           self.assertTrue(iotests.compare_images(test_img, target_img),
>                           'target image does not match source after mirroring')
>
diff mbox series

Patch

diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 5cc02b24fc..d2c9669741 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -120,7 +120,18 @@  class TestSingleDrive(iotests.QMPTestCase):
         result = self.vm.qmp('block-job-resume', device='drive0')
         self.assert_qmp(result, 'return', {})
 
-        self.complete_and_wait()
+        self.wait_ready()
+
+        # Check that a job on STANDBY cannot be completed
+        self.pause_job('drive0')
+        result = self.vm.qmp('block-job-complete', device='drive0')
+        self.assert_qmp(result, 'error/desc',
+                        "Job 'drive0' has been paused by the user")
+
+        result = self.vm.qmp('block-job-resume', device='drive0')
+        self.assert_qmp(result, 'return', {})
+
+        self.complete_and_wait(wait_ready=False)
         self.vm.shutdown()
         self.assertTrue(iotests.compare_images(test_img, target_img),
                         'target image does not match source after mirroring')