From nobody Sat Apr 20 09:26:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1489183642364914.6147263440215; Fri, 10 Mar 2017 14:07:22 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 4120982063D; Fri, 10 Mar 2017 22:07:21 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 834598205D8 for ; Fri, 10 Mar 2017 22:06:28 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2AM4DRI121412 for ; Fri, 10 Mar 2017 17:06:27 -0500 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0a-001b2d01.pphosted.com with ESMTP id 2941dwyh2b-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Mar 2017 17:06:27 -0500 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Mar 2017 19:06:25 -0300 Received: from d24relay03.br.ibm.com (9.18.232.225) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Mar 2017 19:06:24 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2AM6NYF34865320 for ; Fri, 10 Mar 2017 19:06:23 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v2AM6NjI018218 for ; Fri, 10 Mar 2017 19:06:23 -0300 Received: from t440.ibm.com ([9.80.210.122]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v2AM6BKB018086; Fri, 10 Mar 2017 19:06:22 -0300 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 10 Mar 2017 19:06:08 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489183571-10933-1-git-send-email-luciojhc@linux.vnet.ibm.com> References: <1489183571-10933-1-git-send-email-luciojhc@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17031022-0024-0000-0000-0000015CF4CD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031022-0025-0000-0000-0000162305C3 Message-Id: <1489183571-10933-6-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-10_15:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703100171 Subject: [Kimchi-devel] [PATCH] [Kimchi 5/8] Remove 'run as root' requirement from some tests X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Lucio Correia --- tests/test_model.py | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/tests/test_model.py b/tests/test_model.py index 78c291e..8595862 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -381,11 +381,10 @@ class ModelTests(unittest.TestCase): info =3D inst.vm_lookup('kimchi-vm') self.assertEquals('running', info['state']) =20 - @unittest.skipUnless(utils.running_as_root() and - os.uname()[4] !=3D "s390x", 'Must be run as root') + @unittest.skipUnless(os.uname()[4] !=3D "s390x", 'Not applicable to s3= 90x') def test_vm_graphics(self): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) - params =3D {'name': 'test', + inst =3D model.Model('qemu:///session', self.tmp_store) + params =3D {'name': 'test', 'domain': 'kvm', 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} inst.templates_create(params) with RollbackContext() as rollback: @@ -409,10 +408,9 @@ class ModelTests(unittest.TestCase): =20 inst.template_delete('test') =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_vm_virtviewerfile_vmnotrunning(self): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) - params =3D {'name': 'test', + inst =3D model.Model('qemu:///session', self.tmp_store) + params =3D {'name': 'test', 'domain': 'kvm', 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} inst.templates_create(params) =20 @@ -972,14 +970,14 @@ class ModelTests(unittest.TestCase): cur_cdrom_path =3D re.sub(":80/", '/', cdrom_info['path']) self.assertEquals(valid_remote_iso_path, cur_cdrom_path) =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_vm_storage_provisioning(self): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 with RollbackContext() as rollback: params =3D {'name': 'test', 'disks': [{'size': 1, 'pool': { 'name': '/plugins/kimchi/storagepools/default'}}], - 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} + 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}, + 'domain': 'kvm'} =20 inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test') @@ -1029,9 +1027,8 @@ class ModelTests(unittest.TestCase): xpath =3D "/domain/devices/disk[@device=3D'disk']/driver/@type" return xpath_get_text(xml, xpath)[0] =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_template_get_default_vol_format_from_conf(self): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 with RollbackContext() as rollback: self._create_template_conf_with_disk_format('vmdk') @@ -1039,7 +1036,8 @@ class ModelTests(unittest.TestCase): =20 params =3D {'name': 'test', 'disks': [{'size': 1, 'pool': { 'name': '/plugins/kimchi/storagepools/default'}}], - 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} + 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}, + 'domain': 'kvm'} inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test') =20 @@ -1054,9 +1052,8 @@ class ModelTests(unittest.TestCase): ) self.assertEqual(created_disk_format, 'vmdk') =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_template_creates_user_defined_vol_format_instead_default(self= ): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 default_vol =3D 'vmdk' user_vol =3D 'raw' @@ -1064,7 +1061,7 @@ class ModelTests(unittest.TestCase): self._create_template_conf_with_disk_format(default_vol) rollback.prependDefer(self._restore_template_conf_file) =20 - params =3D {'name': 'test', 'disks': [{ + params =3D {'name': 'test', 'domain': 'kvm', 'disks': [{ 'size': 1, 'format': user_vol, 'pool': {'name': '/plugins/kimchi/storagepools/default'}}], 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} @@ -1083,9 +1080,8 @@ class ModelTests(unittest.TestCase): ) self.assertEqual(created_disk_format, user_vol) =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_template_uses_qcow2_format_if_no_user_or_default_defined(self= ): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 with RollbackContext() as rollback: self._create_template_conf_with_disk_format(None) @@ -1093,7 +1089,8 @@ class ModelTests(unittest.TestCase): =20 params =3D {'name': 'test', 'disks': [{'size': 1, 'pool': { 'name': '/plugins/kimchi/storagepools/default'}}], - 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} + 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}, + 'domain': 'kvm'} inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test') =20 @@ -1659,12 +1656,11 @@ class ModelTests(unittest.TestCase): vms =3D inst.vms_get_list() self.assertFalse(u'k=C4=AB=D0=BC=D1=81h=C4=AB-=E2=88=A8=D0=BC'= in vms) =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_vm_list_sorted(self): - inst =3D model.Model(objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) =20 with RollbackContext() as rollback: - params =3D {'name': 'test', 'disks': [], + params =3D {'name': 'test', 'disks': [], 'domain': 'kvm', 'source_media': {'type': 'disk', 'path': UBUNTU_ISO}} inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test') @@ -1765,10 +1761,9 @@ class ModelTests(unittest.TestCase): self.assertIn('os_arch', distro) self.assertIn('path', distro) =20 - @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_deep_scan(self): - inst =3D model.Model(None, - objstore_loc=3Dself.tmp_store) + inst =3D model.Model('qemu:///session', self.tmp_store) + with RollbackContext() as rollback: deep_path =3D os.path.join(TMP_DIR, 'deep-scan') subdir_path =3D os.path.join(deep_path, 'isos') --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel