Francesco Romani has uploaded a new change for review.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
tests: vm: add unit tests for setBalloonTarget
This patch add unit tests for the setBalloonTarget API call.
Change-Id: I97d4667204560a372d10ab3ed0aa69b3407e671a Signed-off-by: Francesco Romani fromani@redhat.com --- M tests/vmTests.py 1 file changed, 38 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/29390/1
diff --git a/tests/vmTests.py b/tests/vmTests.py index 7ee2eb8..8a4b90a 100644 --- a/tests/vmTests.py +++ b/tests/vmTests.py @@ -54,9 +54,11 @@
class FakeDomain: - def __init__(self, xml=''): + def __init__(self, xml='', fail=False): self._xml = xml self.devXml = '' + self._fail = fail + self.calls = {}
def info(self): raise libvirt.libvirtError(defmsg='') @@ -76,6 +78,11 @@ def schedulerParameters(self): return {'vcpu_quota': vm._NO_CPU_QUOTA, 'vcpu_period': vm._NO_CPU_PERIOD} + + def setMemory(self, target): + if self._fail: + raise libvirt.libvirtError(defmsg='') + self.calls['setMemory'] = (target,)
class TestVm(TestCaseBase): @@ -1239,3 +1246,33 @@ {'type': 'graphics', 'device': devType}] with FakeVM(self.conf, devices) as fake: self.assertRaises(ValueError, fake.buildConfDevices) + + +class TestVmBalloon(TestCaseBase): + def assertAPIFailed(self, res, specificErr=None): + if specificErr is None: + self.assertNotEqual(res['status']['code'], 0) + else: + self.assertEqual(res['status']['code'], + define.errCode[specificErr]['status']['code']) + + def testSucceed(self): + with FakeVM() as vm: + vm._dom = FakeDomain(fail=False) + target = 256 + self.assertEqual(vm.setBalloonTarget(target)['status']['code'], 0) + self.assertEqual(vm._dom.calls['setMemory'][0], target) + + def testVmWithoutDom(self): + with FakeVM() as vm: + self.assertTrue(vm._dom is None) + self.assertAPIFailed(vm.setBalloonTarget(128)) + + def testTargetValueNotInteger(self): + with FakeVM() as vm: + self.assertAPIFailed(vm.setBalloonTarget('foobar')) + + def testLibvirtFailure(self): + with FakeVM() as vm: + vm._dom = FakeDomain(fail=True) + self.assertAPIFailed(vm.setBalloonTarget(256), 'balloonErr')
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/9749/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10534/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/10691/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 1: Verified+1
verified by running the tests themselves.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10064/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10849/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11006/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10071/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/10856/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11013/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 5: Verified+1
verified by run the tests themselves.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10233/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11018/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11175/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 5:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10235/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11020/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11177/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 5: Code-Review+2
seems harmless
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 6:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10502/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11287/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11444/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 7: Verified+1
lost score after not trivial rebase; re-verified by re running the tests again.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 7:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10558/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11500/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11343/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 8:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/10908/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/11850/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/11693/ : SUCCESS
Francesco Romani has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 9: Verified+1
rebased against master. Verified by running the test themselves.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 9:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/11438/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/12382/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/12227/ : SUCCESS
Dan Kenigsberg has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 9: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
tests: vm: add unit tests for setBalloonTarget
Change-Id: I97d4667204560a372d10ab3ed0aa69b3407e671a Signed-off-by: Francesco Romani fromani@redhat.com Reviewed-on: http://gerrit.ovirt.org/29390 Reviewed-by: Dan Kenigsberg danken@redhat.com --- M tests/vmTests.py 1 file changed, 36 insertions(+), 0 deletions(-)
Approvals: Dan Kenigsberg: Looks good to me, approved Francesco Romani: Verified
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: vm: add unit tests for setBalloonTarget ......................................................................
Patch Set 10:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_create-rpms_merged/1857/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_create-rpms_merged_test_debug/198/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5831/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3990/ : FAILURE
vdsm-patches@lists.fedorahosted.org