On 04/25/2012 07:17 AM, Stefan Hajnoczi wrote: > Add tests to exercise the InvalidParameter 'speed' error code path, as > well as the regular success case for setting the speed. The > block-stream 'speed' parameter allows the speed limit of the job to be > applied immediately when the job starts instead of issuing a separate > block-job-set-speed command later. If the parameter has an invalid > value we expect to get an error and the job is not created. > > It turns out that cancelling a block job is a common operation in these > test cases, let's extract a cancel_and_wait() function instead of > duplicating the QMP commands. > > Signed-off-by: Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> > Acked-by: Kevin Wolf <kw...@redhat.com> > ---
> + > + def test_set_speed_invalid(self): > self.assert_no_active_streams() > > + result = self.vm.qmp('block-stream', device='drive0', speed=2 * 1024 > * 1024) > + self.assert_qmp(result, {}) > + > + self.assert_no_active_streams() > + > + result = self.vm.qmp('block-stream', device='drive0') > + self.assert_qmp(result, 'return', {}) > + > + result = self.vm.qmp('block-job-set-speed', device='drive0', > speed=-1) > + self.assert_qmp(result, 'error/class', 'InvalidParameter') > + self.assert_qmp(result, 'error/data/name', 'speed') > + > + self.cancel_and_wait() > + > + def test_set_speed_invalid(self): Duplicate def test_set_speed_invalid. Bad copy-and-paste issue? The first one looks bogus, the second one looks correct. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature